Question

I have an app that is designed to run in portrait and all is well. However I have implemented Mobfox's vAds which require landscape mode.

At present I get the following error when the vAD is called

2013-01-08 23:44:05.109 Tv - IOS[1422:907] mobfox video did load
2013-01-08 23:44:05.125 Tv - IOS[1422:907] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

So the im thinking the fix would be allow for landscape in the app.

I need to force the app to run in portrait but allow for landscape when the vAd is called

So just to recap:

I need Portrait only orientation during normal app view and landscape/portrait during the mobFox vAd view is visible.

Was it helpful?

Solution

Return NO for shouldAutorotate:

-(BOOL)shouldAutorotate {
  return NO;
}

Or if it is YES you need to return the supportedInterfaceOrientations (at least one), here its only allowing portrait:

- (NSUInteger)supportedInterfaceOrientations{
  return UIInterfaceOrientationMaskPortrait;
  if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
      return UIInterfaceOrientationMaskAll;
  }
}

OTHER TIPS

Ok, after sleeping on this i managed to finally resolve the problem.

Solution: I had to subclass UINavigationController and override the autorotation methods and allow all rotations in in project > Target > summary settings

- (BOOL)shouldAutorotate {
return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
// pre-iOS 6 support 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top