如何知道在我们的快捷方式应用程序中添加了特定的快捷方式,或者不使用我们的iOS应用程序?
我使用下面给出的x回调url运行快捷方式代码:如何知道在我们的快捷方式应用程序中添加了特定的快捷方式,或者不使用我们的iOS应用程序?,ios,swift,shortcut,sirishortcuts,Ios,Swift,Shortcut,Sirishortcuts,我使用下面给出的x回调url运行快捷方式代码: let url = URL(string: "shortcuts://x-callback-url/run-shortcut?name=Airplane&x-success=shortcutsdemo://") UIApplication.shared.open(url!, options: [:], completionHandler: nil) 当我在UIApplication.shared.open中打开URL时,它会运行快捷方式,
let url = URL(string: "shortcuts://x-callback-url/run-shortcut?name=Airplane&x-success=shortcutsdemo://")
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
当我在UIApplication.shared.open
中打开URL时,它会运行快捷方式,完成后,返回到我们的iOS应用程序
我的问题是,如果我的快捷方式没有添加到快捷方式应用程序中,我该如何管理
有没有办法先在快捷方式应用程序中找到是否添加了快捷方式,然后再运行快捷方式
比如:
if (Shortcut.isInstalled) {
let url = URL(string: "shortcuts://x-callback-url/run-shortcut?name=Airplane&x-success=shortcutsdemo://")
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
} else {
print("Not installed")
}
摘要:
如果快捷方式添加到我们的快捷方式应用程序中,那么它将使用我们的iOS应用程序运行快捷方式。否则它不会运行。并为该快捷方式提供一个错误。我认为您需要使用
func-canOpenURL(url:url)->Bool
let url = URL(string: "shortcuts://x-callback-url/run-shortcut?name=Airplane&x-success=shortcutsdemo://")
if UIApplication.shared.canOpenURL(ur!l) {
print("Short uts is installed")
} else {
print("Shortcuts not installed")
}
我不是100%确定,但我认为它会自动将您重定向到appstore,如果您没有,请查看 我认为您需要使用
func canOpenURL(url:url)->Bool
let url = URL(string: "shortcuts://x-callback-url/run-shortcut?name=Airplane&x-success=shortcutsdemo://")
if UIApplication.shared.canOpenURL(ur!l) {
print("Short uts is installed")
} else {
print("Shortcuts not installed")
}
我不是100%确定,但我认为它会自动将您重定向到appstore,如果您没有,请查看 我们的快捷方式应用程序中安装了您使用的快捷方式?我猜你是在混淆快捷方式和url模式的概念。我想知道快捷方式是否安装在我们的快捷方式应用程序中?你用快捷方式知道什么安装在我们的快捷方式应用程序中?我猜你是在混淆快捷方式和url模式的概念。我想知道快捷方式是否安装在我们的快捷方式应用程序中?检查快捷方式应用程序是否安装在iPhone中。我想知道是否在快捷方式应用程序中添加了特定的快捷方式。检查是否在iPhone中安装了快捷方式应用程序。我想知道是否在快捷方式应用程序中添加了特定的快捷方式。