如何解决在AppDelegate.swift
当我点击Core Spotlight搜索的结果时,该应用程序启动,但是AppDelegate.swift
中的函数未调用:
func application(_ application: UIApplication,continue userActivity: NSUserActivity,restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
print("called")
}
其中包含用于导航到特定视图控制器并加载数据的逻辑。
有些人here似乎建议使用SceneDelegate.swift
:
func scene(_ scene: UIScene,willConnectTo session: UISceneSession,options connectionOptions: UIScene.ConnectionOptions) {
print("called"
}
但也不会从Core Spotlight调用。
似乎唯一被调用的函数是:
func sceneDidBecomeActive(_ scene: UIScene) {}
func sceneWillEnterForeground(_ scene: UIScene) {}
在SceneDelegate.swift
中,但没有必需的userActivity
参数。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。