Expose UIStateRestorationViewControllerStoryboardIdentifier

Originator:zach
Number:rdar://27539555 Date Originated:26-Jul-2016 00:42 AM
Status:Open Resolved:false
Product:iOS SDK Product Version:iOS 10.0 (14A5309d)
Classification:Enhancement Reproducible:Always
 
Summary:
UIKit State Restoration has an automatic mechanism that restores view controllers from a graph of storyboards. UIApplicationDelegate exposes `application(_:viewControllerWithRestorationIdentifierPath:coder:)` to replace this mechanism with you own (in our case, we wanted 99% native behavior but adding dependency injection), helpfully documenting the UIStateRestorationViewControllerStoryboardKey key for the coder for getting the storyboard associated with an identifier.

Yet, with this alone, it is not possible to fully replace the native mechanism in certain cases.

Steps to Reproduce:
1. Deploy a project to iOS 8.
2. Build two storyboards that resolve to identical identifier pathways. 
3. Build a third storyboard that links to the first two via storyboard references (i.e., a split view controller)
4. Run and state-save the app.

Expected Results:
My custom `application(_:viewControllerWithRestorationIdentifierPath:coder:)` implementation can deserialize the entire tree of view controllers.

Actual Results:
Without knowing the exact storyboard identifier chain *and* the storyboard that it comes from, I can only re-assemble the `identifierComponents`, which leads to me unpacking the wrong view controller. 

Version:
iOS 10.0 (14A5309d)

Notes:
If exposing this were a simple impossibility, a hook-point for post-restore, pre-use access to restored VCs would be necessary.

Configuration:
iPhone 6s Plus 64GB Version, using Wi-Fi

Attachments:

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!