UIWindowSceneDelegate and restoreInteractionStateWith

iPadOS 15, I have a multiple windows app for a documents app. My UIWindowSceneDelegate works so far properly but I have issue with 1 case scenario.

I have an App Icon menu with the UIApplication.shortcutItems which handle the recent open docs.

When I use this menu to open a doc while my app is already in background, no issue. I receive the willConnect in the delegate and process the shortcutItem. So far so good.

Now if I do the same while the app is closed. There is the issue. I receive the willConnect as expected but immediately after the delegate restoreInteractionStateWith get called. Overriding the launched doc by another from the restoreInteractionStateWith.

Did I mis-understand the life cycle for this scenario? Or is it a bug?

My hacky solution so far is that if the 2 methods get called (with the shortcutItem) with less than 0.1 sec I ignore the restoration method.

Thanks for the support

UIWindowSceneDelegate and restoreInteractionStateWith
 
 
Q