UIPresentationController initialisation

Number:rdar://22269465 Date Originated:2015-08-13
Status:Closed Resolved:
Product:iOS SDK Product Version:9.0
Classification: Reproducible:Always
UIPresentationController does not follow the designated initialiser pattern and is lax about checking arguments, resulting in exceptions being raised later rather than immediately.

Steps to Reproduce:
Look at UIPresentationController.h and also try making a presentation controller with alloc & init.

Expected Results:
- initWithPresentedViewController:presentingViewController: to be marked with NS_DESIGNATED_INITIALIZER.
- UIPresentationController to override init and call initWithPresentedViewController:presentingViewController: (or raise an exception).
- The implementation of initWithPresentedViewController:presentingViewController: to raise an exception if either of the arguments are nil.

With these things in place, creating a presentation controller without the required parameters would raise an exception immediately.

Actual Results:
- initWithPresentedViewController:presentingViewController: is not marked with NS_DESIGNATED_INITIALIZER.
- UIPresentationController does not override init.
- The implementation of initWithPresentedViewController:presentingViewController: silently accepts nil arguments.

Creating a presentation controller without the required parameters results in an exception when presenting: trying to add nil to a set. See http://stackoverflow.com/questions/27198145/mysterious-crash-when-presenting-a-view-controller-using-a-custom-uipresentation

iOS 9.0, Xcode 7.0 beta 5 (7A176x)





Resolved in iOS 10. UIPresentationController.h contains

  • (instancetype)init NS_UNAVAILABLE;
By douglashill at June 15, 2016, 6:14 p.m. (reply...)

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!