application(_:url:options:) 永远不会被调用 [英] application(_:url:options:) is never called
问题描述
重现步骤:
- 在 Xcode 11 中使用默认设置创建一个新项目:Single View App/Swift/Storyboards.
- 添加您的文档类型和导入的 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?
添加到您的 AppDelegate
.
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屋!