application(_:url:options:) is never called

人走茶凉 提交于 2020-01-04 05:41:13

问题


Steps to reproduce:

  1. Create a new project with default settings in Xcode 11: Single View App / Swift / Storyboards.
  2. Add your Document Types and Imported UTIs.

Result: My application appears in “Copy to...” menu (or “Open in...” if we use LSSupportsOpeningDocumentsInPlace). It really launches the app. But this delegate method: application(_:url:options:) is never called.


回答1:


In iOS 13 this method was replaced with a new UISceneDelegate method by default.

Solution:

If you don't need scenes, just remove all scene-related code: SceneDelegate etc., remove UIApplicationSceneManifest from Info.plist, and add var window: UIWindow? to your AppDelegate.

application(_:url:options:) is working now.



来源:https://stackoverflow.com/questions/58624477/application-urloptions-is-never-called

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!