ios - iOS 13 performActionFor shortcutItem 现在在启动时不会在 SceneDelegate 中调用,但在应用启动后会调用。为什么?
问题描述
performActionFor shortcutItem
如果应用程序已经启动,则在我的 SceneDelegate 中调用,但如果应用程序实际上从快捷方式项启动,则不会调用它。为什么是这样?
解决方案
当从快捷方式项目启动应用程序时(并且当后台没有应用程序实例时),您可以从 sceneDelegate 中的 willConnectTo 函数获取 ShortcutItems
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let shortcutItems = connectionOptions.shortcutItem{
}
}
推荐阅读
- java - 如何告诉 Java 变量不可能为空?
- java - 当条件为真时,从头开始执行各种操作的序列
- sql-server - 在事务日志方面,将Recovery模型改为Bulk Logged后的SQL Bulk Insert和SQL Insert有什么区别?
- ibm-cloud - 在 Watson Assistant 中处理来自 IBM Cloud Function 的多个答案
- python - 使用 ndimage.maximum_filter 和 skimage.peak_local_max 查找图像峰值
- javascript - 使用 Javascript 添加一行额外的 HTML 表单输入
- c - 为什么这个输出字符串要编号?
- windows - Flutter 卡在“flutter”命令上 - 没有输出到控制台并且它永远不会完成
- apache - 除非我强制不重新加载缓存浏览器,否则上传的文件在浏览器中不可见
- android - React Native 项目不适用于 android studio