1

performActionFor shortcutItem如果应用程序已经启动,则在我的 SceneDelegate 中调用,但如果应用程序实际上从快捷方式项启动,则不会调用它。为什么是这样?

4

1 回答 1

4

当从快捷方式项目启动应用程序时(并且当后台没有应用程序实例时),您可以从 sceneDelegate 中的 willConnectTo 函数获取 ShortcutItems

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let shortcutItems = connectionOptions.shortcutItem{
    }
}
于 2019-09-25T05:47:41.393 回答