Merely accessing the presentationController changes program flow and breaks rotation.

Originator:steipete
Number:rdar://19096083 Date Originated:29-Nov-2014 09:01 PM
Status:Closed Resolved:
Product:iOS Product Version:8.1.1
Classification:UI/Usability Reproducible:Always
 
Summary:
Merely accessing the presentationController changes program flow and breaks rotation.

Steps to Reproduce:
Open sample, press “show modal”. Observe that it is presented in portrait, even though we have preferredInterfaceOrientationForPresentation overridden to UIInterfaceOrientationLandscapeLeft.

Change the program and comment out the single [navController presentationController];, run again and observe that everything’s working as expected now.

Expected Results:
Accessing a getter should not have side effects. preferredInterfaceOrientationForPresentation should always be honored.

Actual Results:
Accessing a getter has side effects, calls  -[UIViewController _setTemporaryPresentationController:], and later on runs through different code paths in -[UIViewController _presentViewController:withAnimationController:completion:] (which doesn’t re-set the modalPresentationStyle) and then ultimately doesn’t query the preferred rotation in _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation.

Regression:
This API didn’t exist in iOS 7.

Notes:
Tracking down this bug was quite a lot of fun :)

Comments

Fixed in iOS 10b1

Example: http://cl.ly/2C0w0n0d2z0f

Fixed in PSPDFKit 4.2.0


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!