Reputation: 8497
When I test my single view app under 4.x in the simulator or device, upon startup the main UIViewController's shouldAutorotateToInterfaceOrientation:
method is called precisely 3046 times (on device) or 23777 times (on simulator) and then crashes. ...updated...
UPDATE: Inside the method I have
UIInterfaceOrientation currentOrientation = self.interfaceOrientation;
This seems to be the culprit, it causes shouldAutorotateToInterfaceOrientation: to be called again, therefore putting it into an infinite loop until it crashes. Anyone know why? It doesn't do this in iOS 5+
Upvotes: 1
Views: 432
Reputation: 1097
if you need to do any processing on Orientation change event, use this method instead,
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[self HandleOrientationChange:toInterfaceOrientation];
}
-(void) HandleOrientationChange:(UIInterfaceOrientation) orientation
{}
Upvotes: 1