永远不会调用application(_:url:options :) [英] application(_:url:options:) is never called
问题描述
复制步骤:
- 使用Xcode 11:Single View App/Swift/情节提要中的默认设置创建一个新项目.
- 添加您的文档类型和导入的UTI.
结果:我的应用程序显示在复制到..."菜单中(如果使用LSSupportsOpeningDocumentsInPlace
,则显示在打开于..."中).
它确实启动了该应用程序.
但是,从未调用过以下委托方法: application(_:url:options:)
.>
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.
推荐答案
在iOS 13中,此方法已替换为新的 UISceneDelegate 方法默认为
In iOS 13 this method was replaced with a new UISceneDelegate method by default.
解决方案:
如果不需要场景,只需删除所有与场景相关的代码:SceneDelegate
等,从 Info.plist 中删除UIApplicationSceneManifest
,然后将var window: UIWindow?
添加到
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:)
现在正在工作.
这篇关于永远不会调用application(_:url:options :)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!