I have an App which supports multiple windows on the iPad. The App can receive URLs from other Apps (via application.openURL()) and also files via "share sheet" (via UIActivityViewController). When receiving a URL from another App the delegate method
scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
will be called on an existing UIScene, however when a file is received through the share sheet from another App, a new UIScene is created and therefore also a new window (eg the delegates
application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions)
and
scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
are called).
In both cases I do get the URL and file just fine, however I do not want to get new UIScenes and windows created when receiving a file via share sheet.
How can I prevent to get a new UIScene or window? The received files should be used in the existing windows and should not create new ones.