My app works perfect on iPhone6 but when I tested it on iPhone7 it crashes when I try to adjust points to an image.
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 says
Last Exception Backtrace (0)
at
[self.view.featurePointsMapping enumerateKeysAndObjectsUsingBlock:^(NSNumber* key, EMFeaturePointView* view, BOOL *stop) {
Spent weeks on this. Any help is welcome!