以下是正确的iOS开发代码示例:

// 使用高德地图导航
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(36.547901, 104.258354);
NSString *appName = @"yourAppName";
NSString *urlString = [NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&poiname=&poiid=BGVIS&lat=%f&lon=%f&dev=1&style=2", appName, coordinate.latitude, coordinate.longitude];
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];

请确保已在info.plist文件中添加了高德地图的URL Scheme:iosamap。


原文地址: https://www.cveoy.top/t/topic/pEP9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录