session.stateRestorationActivity is returning nil on Catalyst app.

Hi there,

I've setup scene-based state restoration for my iPhone/iPad app and it works perfectly.

In func sceneWillResignActive(_ scene: UIScene) I create an NSUserActivity object and assigned it to the scene.userActivity

I then return scene.userActivity from func stateRestorationActivity(for scene: UIScene) -> NSUserActivity? 

The first issue I'm facing with Catalyst is func sceneWillResignActive(_ scene: UIScene) is being called after func stateRestorationActivity(for scene: UIScene) -> NSUserActivity?  so the restoration activity is never set.

I tried setting the scene.userActivity in the func stateRestorationActivity(for scene: UIScene) -> NSUserActivity?  function and it seemed to work insomuch as I can see there is an NSUserActivity created. Even so, session.stateRestorationActivity is nil when func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) is called.

I've disabled the "Close windows when quitting app" option in System Preference > General. I also noticed a post somewhere suggesting you wait for the app to disappear from Activity Monitor before relaunching. I've tried this to no avail.

Is your scene’s window restored to the same location and size on your screen after you quit and relaunch your app?

session.stateRestorationActivity is returning nil on Catalyst app.
 
 
Q