func scene(_ scene: UIScene, openURLContexts URLContexts: Set) not called

This is an iOS app that runs on Mac in iPad mode.

on Mac, I want to be able to drop a file (pdf) on the app icon and see it in the app to display some notification that operation was OK.

For this, I use notification, sent from sceneDelegate. All VC add observer for the notification, allowing to display whatever the front VC is.

It works OK in most cases, except when:

  • I drop a file on the app icon in the dock (app launched from Xcode which creates the icon in dock)

In this case, I need to repeat the drop to get the notification sent.

  • After that, it works systematically.

The problem does not come from notification, but because func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) is not called, as I could test with:

    func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
        print("dropped")
}

dropped is logged only on second drop.

Why does this occur only for the dock icon ?

func scene(_ scene: UIScene, openURLContexts URLContexts: Set) not called
 
 
Q