IOS + SpriteKit: How to force portrait mode?

I am currently working on a SpriteKit game for iOS 7+ and Xcode 6. The game should always be presented in portrait mode. So far, I have implemented these methods in my controller:

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

This works great while I launch an app that supports my iPad in portrait mode. It does not switch orientation during the game.

But when you launch the iPad in landscape orientation during application launch, the game is displayed in landscape orientation.

How to make the application appear in portrait mode, even if the device was saved in landscape mode during startup?

+4
source share
1 answer

To solve the problem of application orientation

Go to your projects plist file (should be "YourApp-Info.plist")
Add a row and enter "Supported interface orientations"
Add the orientations that your app supports 
+11

All Articles