Post

Replies

Boosts

Views

Activity

Reply to State Restoration not restoring root view controller
Yes, I have gone through all of Apple's documentation including the sample project you mentioned. That project and its related article say, "If your app doesn’t support scenes, use the view-controller-based state restoration process to preserve the state of your interface instead." Unfortunately moving to UISceneDelegate would be difficult for this project so using the view-controller-based state restoration would be ideal. However Apple's sample project uses a storyboard for this which, as I said, our app does not. The GitHub project I linked to above does not use the UISceneDelegate APIs and works without a storyboard. Unfortunately it seems to require that the view controllers already exist even in the case where they are being restored. Which seems ... odd, given that viewControllerWithRestorationPath:coder is being called correctly. What I need to understand is how to actually assign the decoded rootViewController to the window's rootViewController property. As I said, I can see that all of the view controllers that were encoded to the archive are correctly created by viewControllerWithRestorationIdentifierPath:coder: during the restoration process at startup.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jan ’25