![](/img/trans.png)
[英]What could be causing this “Fatal Exception: CALayerInvalidGeometry CALayer bounds contains NaN: [nan nan; nan nan]” crash?
[英]App crashes on iPhone7 only: Fatal Exception: CALayerInvalidGeometry CALayer position contains NaN: [nan nan]
我的應用程序可以在iPhone6上完美運行,但是當我在iPhone7上進行測試時,當我嘗試調整圖像點時會崩潰。
致命異常:CALayerInvalidGeometry CALayer位置包含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說
最后異常回溯(0)
在
[self.view.featurePointsMapping enumerateKeysAndObjectsUsingBlock:^(NSNumber* key, EMFeaturePointView* view, BOOL *stop) {
花了幾個星期。 歡迎任何幫助!
我建議您添加一個檢查以確保featurePointsBox rect不包含任何NaN值。
請參閱以下線程: 如何在Objective-C(iphone sdk)中檢查NaN值
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.