• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation


  • Subject: iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation
  • From: "Mazzaroth M." <email@hidden>
  • Date: Mon, 04 Feb 2013 00:36:28 -0500

I am getting this error in a universal iOS 6.0 sdk app:


2013-02-03 23:41:57.078 scrappling[20350:c07] *** Terminating app due to
uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason:
'preferredInterfaceOrientationForPresentation must return a supported
interface orientation!'

This occurs in the iPad 6.0 simulator, simulating a non-retina ipad.

The initial view controller of the app is a UITabViewController subclass.
The storyboard for the app looks like this:

http://dl.dropbox.com/u/597030/debugging/Screen Shot 2013-02-03 at 11.50.49 PM.png

This is how I reproduce the crash:

1)select an item in the master tableviewcontroller which calls [self
presentMoviePlayerViewControllerAnimated:_playerVC];
2)_playerVC is a MPMoviePlayerViewController subclass that presents a video
fullscreen.
3)the moment I tap "Done" on the video, Cocoa Touch fires
[MMATabBarController preferredInterfaceOrientationForPresentation] and
returns UIInterfaceOrientationMaskLandscape:

MMATabBarController.m:

~snip~
-(BOOL)shouldAutorotate
{
  return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{

  if([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone)
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{

//  return UIInterfaceOrientationMaskAll;
  if([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone)
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}
~snip~

4)I've confirmed UIInterfaceOrientationMaskLandscape gets returned from
-preferredInterfaceOrientationForPresentation
5)I've confirmed UIInterfaceOrientationMaskLandscape gets returned from
-supportedInterfaceOrientations

6)Crash!


~~~~~~~~


What I don't understand is why this message is occurring because I have
confirmed that at startup [MMATabBarController
-supportedInterfaceOrientations] returns
UIInterfaceOrientationMaskLandscape. Also my info.plist looks like this:

  <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>

Attempted workarounds:

1)I had -preferredInterfaceOrientationForPresentation return
UIInterfaceOrientationMaskAll.

2) I added the application:supportedInterfaceOrientationsForWindow:
delegate method to the app delegate. I've confirmed that this gets fired
and UIInterfaceOrientationMaskLandscape gets returned:


-(NSUInteger)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
  if([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone)
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}

3) I subclassed UINavigationController and I've confirmed that on app
startup UIInterfaceOrientationMaskLandscape is returned. The
UINavigationController looks like this:

MMANavigationController.m:

~snip~
-(BOOL)shouldAutorotate
{
  return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{

  if([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone)
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{

//  return UIInterfaceOrientationMaskAll;
  if([[UIDevice currentDevice] userInterfaceIdiom] ==
UIUserInterfaceIdiomPhone)
  {
    return UIInterfaceOrientationMaskPortrait;
  }
  else
  {
    return UIInterfaceOrientationMaskLandscape;
  }
}
~snip~

Any suggestions on what may be going wrong?

Michael
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation
      • From: Louis Romero <email@hidden>
  • Prev by Date: Re: new to Cocoa/Objective-c: many points of confusion
  • Next by Date: Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
  • Previous by thread: Re: NSOperation communicating progress?
  • Next by thread: Re: iOS 6.0 SDK UIApplicationInvalidInterfaceOrientation
  • Index(es):
    • Date
    • Thread