How to solve CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]?
I think this error occurs because the layer which is executed has frame in this form:
Layer frame == {{inf, inf}, {0, 0}}
Here inf is infimum. Its set of numbers.
So the solution to avoid this kind of issue just create condition before return of layer.Like as:
if (layer.frame.size.width ==0 || layer.frame.size.height ==0 ) { return [self simpleLayer];}else{ return layer; }
Where simple layer is like as :
-(CALayer *)simpleLayer{ CALayer *layer = [[CALayer alloc] init]; [layer setFrame:CGRectMake(0, 0, 10, 10)]; [layer setHidden:TRUE]; return layer;}
This condition solved my issue. Try it.
For me it was caused by the toView in this code being nil:
[UIView transitionFromView:self.fromView toView:self.toView duration:0.6 options:(currentPage > toPage ? UIViewAnimationOptionTransitionCurlDown : UIViewAnimationOptionTransitionCurlUp) completion:^(BOOL finished) { if (finished) { } }
I know this question is not very recent but I just want to give an answer. Anyway, I'm guessing your mapView
is of AGSMapView
and you have initialized it this way:
self.mapView = [[[AGSMapView alloc] init] autorelease];
Now, I think the better, if not the only correct way, to initialize it is using initWithFrame
. Though I'm not sure why, mapView
is broken if you use init
for the initialization.
Hope this helps.