打开具有特定纬度和液化天然气的本机iOS地图应用程序



如何通过在目标 C 的特定纬度和 LNG 处添加引脚来打开本机 ios 地图应用程序。

对于 Swift 3 和 swift 4

let apiKey = "https://www.google.com/maps/dir/" + userCurrentLocation.coordinate.latitude + "," + userCurrentLocation.coordinate.longitude + "/" + nextCurrentLocation.coordinate.latitude + "," + nextCurrentLocation.coordinate.longitude
var url = URL(string: apikey)
UIApplication.shared.open(openUrl!, options: [:]) { (res:Bool) in
}

对于目标 c 使用

NSString *apikey = [NSString stringWithFormat:@"https://www.google.co.in/maps/dir/%f,%f/%f,%f",userCurrentLocation.coordinate.latitude,userCurrentLocation.coordinate.longitude,nextCurrentLocation.coordinate.latitude,nextCurrentLocation.coordinate.longitude;
NSURL *url = [NSURL URLWithString:apikey];
[[UIApplication sharedApplication] openURL:url];

相关内容

最新更新