[英]Is it possible to run google maps navigation in IOS instead apple maps
[英]ios navigation with apple or google maps with several targets
我使用下面的代码,它可以正常工作几个月,但是现在新版的Google地图在线版本不再支持这样要求的多个目标。
因此,您需要像这样调整网址: https : //www.google.com/maps/dir/longitude,纬度/ 经度,纬度
在这里您可以找到有关url搜索的更多信息: http : //gearside.com/easily-link-to-locations-and-directions-using-the-new-google-maps/
我当前的解决方案是使用链接在safari上打开google地图,在其中添加+至:目标之间的目标:
for (int i == 0; int i < route.count; i++) {
if (i == 0) {
NSString *start = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f", latitude, longitude];
locationString = start;
}
if (i != 0 && i != route.count - 1) {
NSString *between = [NSString stringWithFormat:@"+to:%f,%f", latitude, longitude];
locationString = [locationString stringByAppendingString:between];
}
if (i == route.count - 1) {
NSString *end = [NSString stringWithFormat:@"&daddr=%f,%f", latitude, longitude];
NSString *type = @"&dirflg=w";
locationString = [locationString stringByAppendingString:end];
locationString = [locationString stringByAppendingString:type];
}
}
NSURL *url = [NSURL URLWithString:locationString];
[[UIApplication sharedApplication] openURL:url];
如果我使用的是iOS 5或6 sSimulator,它将在Safari上的maps.google.com移动版上打开链接,则此方法可以正常工作
但是当我在iOS 5设备上以及可能在安装了Google Maps的iOS6设备上运行它时,链接会在Google Maps中启动,并且路线绘制错误(特别是有许多目标),并且中间的目标没有注释...
有人知道如何强制在Safari中打开链接蜂吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.