如何通过深度链接直接跳转至Shortcuts App的自动化标签页
iOS应用通过深度链接跳转Shortcuts App自动化标签页的实现方法
- 明确深度链接路径:Shortcuts App官方适配的
shortcuts://协议中,自动化标签页对应的固定路径为shortcuts://automations - 项目前置配置:需要在应用的Info.plist文件中,将
shortcuts添加到LSApplicationQueriesSchemes白名单,否则系统会拦截跳转请求 - 跳转代码实现(Swift):
guard let automationShortcutUrl = URL(string: "shortcuts://automations") else { return } // 先判断设备是否安装Shortcuts App,避免跳转失败 if UIApplication.shared.canOpenURL(automationShortcutUrl) { UIApplication.shared.open(automationShortcutUrl, options: [:], completionHandler: nil) }
扩展说明:你参考的官方示例中跳转Gallery页使用的是
shortcuts://gallery,仅需替换URL的路径部分即可跳转至不同功能页,其他常用路径还包括shortcuts://create-shortcut(新建快捷指令页)、shortcuts://run-shortcut?name=指定快捷指令名称(直接运行对应快捷指令)。
内容的提问来源于stack exchange,提问作者Ryan
相关产品推荐
相关产品推荐

