ios - 使用 openURL 的谷歌地图应用重定向问题
问题描述
我对谷歌地图有疑问。在我的设备中,没有安装谷歌地图,但我仍然取得了成功。有什么问题吗??????
@IBAction func clickedBtn(_ sender: Any) {
let customURL = "comgooglemaps://"
if UIApplication.shared.canOpenURL(URL(string: customURL)!) {
print("Success")
UIApplication.shared.open(URL(string: customURL)!, options: [:], completionHandler: nil)
}
else {
let alert = UIAlertController(title: "Error", message: "Google maps not installed", preferredStyle: UIAlertController.Style.alert)
let ok = UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil)
alert.addAction(ok)
self.present(alert, animated:true, completion: nil)
}
}
我还添加了 LSApplicationQueriesSchemes
解决方案
推荐阅读
- javascript - Firestore 使用对象中的 where 子句对象检索文档
- eval - 由于 EVALFILE 的类符号介绍
- swift - 不支持使用带有模块接口的桥接头(XCode)
- javascript - 如何在 discord.js 代码中添加自定义表情符号?
- java - java.security.NoSuchAlgorithmException:TLS_RSA_WITH_AES_128_CBC_SHA256 SSLContext 不可用
- python - Seaborn 的 relplot:有没有办法在使用 hue 参数时将特定颜色分配给所有线条,将另一种颜色分配给另一条线条?
- python - tf.data:从不同形状的 Numpy 数组列表创建数据集
- list - 如何从 vue.js 中所需索引号的列表中获取?
- video - ffmpeg 编码视频产生不正确的 mediainfo 编码设置
- c++ - 编译时未知的 constexpr 函数参数 booleans C++