我正在使用以下代码打开Addison Lee应用程序
如果应用已经安装
,请始终重定向到Appstore// If AddisonLee is not installed, send the user to the Apple App Store
let hereWeGoApp = UIApplication.sharedApplication()
let addisonLeeAppURL = NSURL(string: "addisonlee://")!
if hereWeGoApp.canOpenURL(addisonLeeAppURL) {
// addisonlee is installed; launch it
hereWeGoApp.openURL(addisonLeeAppURL)
} else {
// addisonlee not installed; open App Store
let addisonLeeAppStoreURL = NSURL(string: "https://itunes.apple.com/in/app/addison-lee-mini-cab-taxi/id718312937?mt=8")!
hereWeGoApp.openURL(addisonLeeAppStoreURL)
}
答案 0 :(得分:0)
我认为您的问题是,您尚未将Addison Lee应用的自定义网址方案添加到您的plist中的LSApplicationQueriesSchemes
键。
请参阅此处,了解iOS9附带的此要求的一些详细信息: http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl/
编辑(以下评论): 如果您不知道应用程序是否有自定义URL方案,则需要从捆绑包内部检查plist。 以下是有关如何获取捆绑包并将其打开的一些很好的说明: http://osxdaily.com/2011/04/07/extract-and-explore-an-ios-app-in-mac-os-x/
完成上述操作后,您需要查看Info.plist文件以获取CFBundleURLTypes键。如果它存在,那么您应该找到您正在寻找的URL方案。
答案 1 :(得分:0)
addlee://
是在iOS上打开应用程序的答案