gpt4 book ai didi

ios - 应用程序仅在 iPhone7 上崩溃 : Fatal Exception: CALayerInvalidGeometry CALayer position contains NaN: [nan nan]

转载 作者:行者123 更新时间:2023-12-02 05:23:14 25 4
gpt4 key购买 nike

我的应用程序在 iPhone6 上运行完美,但当我在 iPhone7 上测试它时,当我尝试调整图像的点时,它崩溃了。

Fatal Exception: CALayerInvalidGeometry CALayer position contains NaN: [nan nan]

- (void)adjustPointsToFaceModel {

FaceFeatures *features = self.faceFeaturesModel.features;

CGRect featurePointsBox = [self.view featuresBoundingBox];

[self.view.featurePointsMapping enumerateKeysAndObjectsUsingBlock:^(NSNumber* key, FeaturePointView* view, BOOL *stop) {
FaceFeaturePoint feature = key.unsignedIntegerValue;
CGPoint pointCenter = [self.view convertPointFromImage:[features coordinatePointForFeature:feature]];

if (pointCenter.x < CGRectGetMinX(featurePointsBox)) {
pointCenter.x = CGRectGetMinX(featurePointsBox);
}
if (pointCenter.y < CGRectGetMinY(featurePointsBox)) {
pointCenter.y = CGRectGetMinY(featurePointsBox);
}
if (pointCenter.x > CGRectGetMaxX(featurePointsBox)) {
pointCenter.x = CGRectGetMaxX(featurePointsBox);
}
if (pointCenter.y > CGRectGetMaxY(featurePointsBox)) {
pointCenter.y = CGRectGetMaxY(featurePointsBox);
}
view.center = pointCenter;
}];

[self.view layoutIfNeeded];
}

XCode 说

Last Exception Backtrace (0)

[self.view.featurePointsMapping enumerateKeysAndObjectsUsingBlock:^(NSNumber* key, EMFeaturePointView* view, BOOL *stop) {

为此花了几周时间。欢迎任何帮助!

最佳答案

我建议您添加一个检查以确保 featurePointsBox 矩形不包含任何 NaN 值。

请参阅以下主题: how to check for NaN value in Objective-C (iphone sdk)

关于ios - 应用程序仅在 iPhone7 上崩溃 : Fatal Exception: CALayerInvalidGeometry CALayer position contains NaN: [nan nan],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49145810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com