IOS9: Alternative to UIDevice.currentDevice (). setValue (...) for force orientation

It seems to me that this no longer works in iOS9. It was a de facto way to get orientation changes based on my SO research. Now it freezes my SpriteKit game.

Is it just me, and if anyone does not know an alternative?

EDIT : Portrait and UpsideDown are still working. It seems only landscape modes now cause freeze

EDIT 2: Actually, I think you can go to Portrait ↔ UpsideDown and LandscapeLeft ↔ LandscapeRight, but not between them

+5
source share
3 answers

Adding to the answer Alex: My experience is that Apple blocks orientation changes for iPads iOS9, which does not require full-screen mode. Therefore, if you tell the application that full-screen mode is required, the rotation should work:

enter image description here

However, I do not know if it will solve your SpriteKit freeze, since in my experience iOS9 also introduced a lot of SpriteKit errors.

+15
source

You're right. Setting device orientation is not possible on iOS 9. I think this is due to the new SplitScreen mode on the iPad. Now there can be 2 Applications on the screen at once, and it would be β€œunfair” for one Application to decide which orientation is allowed. Imagine two Applications that force different orientations, what will happen? I think that Apple simply prohibits it at all, although they may restrict the iPad to not full-screen applications.

+1
source

If you have two or more ViewControllers, and you want each of the ViewControllers to have a different orientation, I think the best way to force the VC orientation to use the following code:

let value = UIInterfaceOrientation.LandscapeLeft.rawValue // let value = UIInterfaceOrientation.Portrait.rawValue UIDevice.currentDevice().setValue(value, forKey: "orientation") 

It works for me on iOS 9.

+1
source

All Articles