Mac OS X 10.11: no way to access initial controller when using NSMainStoryboardFile

Originator:bewebste
Number:rdar://22352837 Date Originated:19-Aug-2015 04:21 PM
Status:Open Resolved:
Product:OS X Product Version:Mac OS X 10.11 (15A263e)
Classification:Other Bug Reproducible:Always
 
Summary:
If you have set up a Cocoa application using the NSMainStoryboardFile key in your Info.plist, so that NSApplication will automatically load and display an initial window from a storyboard file, there is no way to later access the NSStoryboard instance or the NSWindowController instance that it created

Steps to Reproduce:
1. Create a new project using the standard OS X “Cocoa Application” template, and check the “Use Storyboards” checkbox
2. In the applicationDidFinishLaunching method of your app delegate, access the window controller that is instantiated by the storyboard and do something with it

Expected Results:
I would expect to be able to do at least one of the following:
1. Access a ‘storyboard’ property on the NSApplication object that returns the NSStoryboard instance it created on startup
2. Access an ‘initialViewController’ property on the NSApplication object that returns the initial view controller that was instantiated by the storyboard
3. Create an outlet for your app delegate to connect to the window controller and connect the outlet in Interface Builder (cross-controller connections are not allowed, it seems)

Actual Results:
None of these things exist.

Notes:
The only workaround I could find for this is to use the NSMainNibFile key in the Info.plist instead to load the main menu, then load a separate storyboard file manually from my app delegate using NSStoryboard.

Comments


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!