ios – 使用Google地图和Apple Maps URL方案自动开始导航

在iOS上使用URL方案启动 Google Maps或 Apple Maps时,有没有办法自动启动导航?

我看到两个可选参数,但没有用户输入就没有开始导航.

解决方法

这是我如何为你的参考,但对于苹果,我还没有找到一种方法来启动通过网址方案导航.
+ (void)navigateToLocation:(CLLocation*)_navLocation {
    if ([[UIApplication sharedApplication] canOpenURL:
         [NSURL URLWithString:@"comgooglemaps://"]]) {
        NSString *string = [NSString stringWithFormat:@"comgooglemaps://?daddr=%f,%f&directionsmode=driving",_navLocation.coordinate.latitude,_navLocation.coordinate.longitude];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
    } else {
        NSString *string = [NSString stringWithFormat:@"http://maps.apple.com/?ll=%f,%f",_navLocation.coordinate.longitude];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
    }
}

以上是来客网为你收集整理的ios – 使用Google地图和Apple Maps URL方案自动开始导航全部内容,希望文章能够帮你解决ios – 使用Google地图和Apple Maps URL方案自动开始导航所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。