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

在iOS上使用URL方案启动 Google MapsApple 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]];
    }
}

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...