supportedInterfaceOrientations not called

Hi I am just converting my project to iOS9 Swift 2


After correcting 152 error and getting the project to assemble I now find that supportedInterfaceOrientations is not being called in my GameViewController.


override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

if UIDevice.currentDevice().userInterfaceIdiom == .Phone {

return [UIInterfaceOrientationMask.Portrait, UIInterfaceOrientationMask.PortraitUpsideDown]

} else {

return [UIInterfaceOrientationMask.Portrait, UIInterfaceOrientationMask.PortraitUpsideDown]

}

}


As setting the masks has no effect on the rotation.


I started a new SKSprite project with xcode 7 Version 7.0 (7A220) and found the same thing wrong. supportedInterfaceOrientations is not called in the example and changing the bits has no effect.


Any help would be great !!!!!!!!!


More info


It is only called if it is on an iPhone setting NOT working on iPad air iPad air 2 WORKS on iPad 2 & iPad Retina

If you started a new project, then it would be one that is compable with Multitasking (which forces you to relinquish control over orientation changes). Given that you further state this works on iPhone and older iPads that do not support any form of multitasking, this seems to be your issue.


If you do not want to support multitasking, then there is a value you can add to your Info.plist (UIRequiresFullscreen if I recall correctly), which may be reasonable if you are writing a game. If you are writing software that should participate in multitasking however, you should redesign to be orientation (and size) agnostic.

There is a checkbox in Xcode for this setting. Select the target (select top of tree in the project navigator, choose the correct target under Targets in the editor area). On the General page, under Deployment Info, the last checkbox is "Requires full screen".

Hi All,


The solution I found was to remove the orientations from the .plict that I did not require from Orientations(iPad) and I set "Requires full screen" as well just in case.


Thanks for all your Help

This is not cool. So you are saying that if you want to support multi-tasking, you cannot specify specificy supported orientations for a given view controller? That makes no sense. At a minimum I would like to let the user of the app decide whether they wanted to use multi-tasking or override interface orientations at runtime, but you are saying that is not possible as well, correct? Not cool. This has been a feature in my app for almost 6 years and now you've pulled the rug out from under it.

If you are in a situation where your application and another are both on screen, your application supports only landscape and the other supports both portrait and landscape what should happen? Should that depend on if your application is the primary or secondary app? Should it depend on the relative size of the two apps (consider there is a 50/50 mode too)?


Multitasking requires you to support all orientations for 2 reasons:

1) The other application (primary or secondary) may support an orientation you don't want to support, and there is no answer to the above questions that makes sense.

2) The sizes when your in multitasking is very different from traditional sizes. 50/50 is about 510x768 - but is that landscape or portrait? The device is in landscape, but the size is potrait. And your application could then be sized larger or smaller (and only if it is sized to take over is that the traditional landscape).


We definately considered this when designing the rrestrictions for multitasking, and applications only supporting some orientations never made any sense in any way that could be expressed to the developer or the user. This is not unlike developing for a desktop system in this way – you don't get strict support of your window sizes (in general) and you don't get that support on iPad multitasking either.

Sorry, but you should leave those decisions up to the developer. Not bail because you think it's too hard for a developer to understand.

If you have suggesstions on how to handle the issues that I mentioned, feel free to file a bug or even discuss them further here. But as I said before, we considered these issues an came to the conclusion that the only way to have a good user experience with multitasking was to give the user, not the developer, control over the interface orientation and how they wanted to use applications. It was not a decision taken lightly or taken because it was too hard for anyone to understand.

Thanks for this info. Even 5 years later, it was helpful! It would be nice if the documentation for supportedInterfaceOrientations and related methods included this info.

supportedInterfaceOrientations not called
 
 
Q