swiftios13ios-sharesheet

application:openUrl:options not called when opening app from share sheet of another app


I would like to open zip files with my app and configured the following:

Document Types enter image description here

This leads to the desired appearing of my app in other app's share sheet. But when I tap my app in that share sheet, my app is opened, but the following method in my AppDelegate is never called:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool

It's a iOS 13 application - what am I missing here?


Solution

  • If your app is using scenes, then instead of application(_:open:options:) from UIApplicationDelegate protocol, iOS will call scene(_:openURLContexts:) from UISceneDelegate.

    https://developer.apple.com/documentation/uikit/uiscenedelegate/3238059-scene

    Also probably it's better to change com.pkware.Zip-archive to com.pkware.zip-archive as it's defined as lowercase in the list of System-Declared UTIs