大佬教程收集整理的这篇文章主要介绍了ios – Waze不加载Swift的导航,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是代码:
@IBACtion func openWazeAction(_ sender: Any) { // open waze if UIApplication.shared.canOpenURL(URL(String: "waze://")!) { let urlStr = String(format: "waze://ul?ll=%f,%f&navigate=yes",(SELEctedBorne?.LOCATIOn?.X)!,(SELEctedBorne?.LOCATIOn?.y)!) print(urlStr) UIApplication.shared.open(URL(String: urlStr)!) } else { UIApplication.shared.open(URL(String: "http://itunes.apple.com/us/app/id323229106")!) } }
print(urlStr)返回正确的URL:waze:// ul?ll = 48.792914,2.366290& navigate = yes,但Waze应用程序中没有任何反应.
(我把LSApplicationQueriesscheR_987_11845@es放在Info.plist文件中.)
这有什么不对?
正确的链接是:
waze://?ll={latitudE},{longitudE}&navigate=yes
迅速
func navigateTo(latitude: Double,longitude: DoublE) { if UIApplication.shared.canOpenURL(URL(String: "waze://")!) { // Waze is installed. Launch Waze and start navigation let urlStr = String(format: "waze://?ll=%f,latitude,longitudE) UIApplication.shared.open(URL(String: urlStr)!) } else { // Waze is not installed. Launch AppStore to install Waze app UIApplication.shared.open(URL(String: "http://itunes.apple.com/us/app/id323229106")!) } }
Objective-C的
(void) navigateToLatitude:(doublE)latitude longitude:(doublE)longitude { if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"waze://"]]) { // Waze is installed. Launch Waze and start navigation NSString *urlStr = [NSString StringWithFormat:@"waze://?ll=%f,longitude]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]]; } else { // Waze is not installed. Launch AppStore to install Waze app [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/id323229106"]]; } }
以上是大佬教程为你收集整理的ios – Waze不加载Swift的导航全部内容,希望文章能够帮你解决ios – Waze不加载Swift的导航所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。