xhr Asked:2020-12-19 20:48:41 +0000 UTC2020-12-19 20:48:41 +0000 UTC 2020-12-19 20:48:41 +0000 UTC 如何获取用户设备上可以构建路由的应用程序列表? 772 如何检查某个应用程序(Yandex.maps、google.maps 或本地地图)是否安装在用户的设备上,以便编译可以在其中构建路线的应用程序列表? swift 1 个回答 Voted Best Answer Andrey Iskamov 2020-12-19T21:28:46Z2020-12-19T21:28:46Z 可以通过深度链接,例如googlemaps或yandexmaps,以同样的方式您可以检查应用程序的可用性 if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) { // открываем googlemaps UIApplication.shared.openURL(URL(string: "comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic")!) } else if (UIApplication.shared.canOpenURL(URL(string:"yandexmaps://")!)) { // открываем yandexmaps UIApplication.shared.openURL(URL(string: "yandexmaps://maps.yandex.ru/?ll=37.62,55.75&z=12")!) } else { // откриваем нативное приложение или проверяем дальше } 更新 您还需要info.plist为链接LSApplicationQueriesSchemes类型参数添加键Array 对于原生地图也有同样的检查UIApplication.shared.canOpenURL(URL(string: "maps://")!),但是最新的更新有问题(它总是返回true),你可以在这里阅读
可以通过深度链接,例如googlemaps或yandexmaps,以同样的方式您可以检查应用程序的可用性
更新
info.plist为链接LSApplicationQueriesSchemes类型参数添加键ArrayUIApplication.shared.canOpenURL(URL(string: "maps://")!),但是最新的更新有问题(它总是返回true),你可以在这里阅读