Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Apple映射当前位置的路由请求URL_Ios_Google Maps_Maps - Fatal编程技术网

Ios Apple映射当前位置的路由请求URL

Ios Apple映射当前位置的路由请求URL,ios,google-maps,maps,Ios,Google Maps,Maps,我现在正在考虑一款iOS应用程序,它可以通过URL链接向没有互联网连接的其他人发送短信,当他们点击链接时,可以在本地地图应用程序中为他们提供指向我所在位置的离线方向。 我知道这可以通过这种URL实现: http://maps.apple.com/maps?saddr=<their location>&daddr=<my location, filled by my app> 我还想将此链接发送给其他平台用户,比如我可以使用的Android用户: http://m

我现在正在考虑一款iOS应用程序,它可以通过URL链接向没有互联网连接的其他人发送短信,当他们点击链接时,可以在本地地图应用程序中为他们提供指向我所在位置的离线方向。 我知道这可以通过这种URL实现:

http://maps.apple.com/maps?saddr=<their location>&daddr=<my location, filled by my app>
我还想将此链接发送给其他平台用户,比如我可以使用的Android用户:

http://maps.google.com/maps?saddr=current_location&daddr=<my location, filled by my app>
Windows Phone我还不知道:

http://maps.???.com/maps?saddr=current_location&daddr=<my location, filled by my app>
任何关键字或答案将非常感谢

你们很接近

苹果地图:

http://maps.apple.com/maps?saddr=Current%20Location&daddr=<Your Location>
谷歌地图:

comgooglemaps-x-callback://?saddr=&daddr=<Your Location>
你很接近

苹果地图:

http://maps.apple.com/maps?saddr=Current%20Location&daddr=<Your Location>
谷歌地图:

comgooglemaps-x-callback://?saddr=&daddr=<Your Location>

如果您使用的是objective-c:

    NSString *urlString = [NSString stringWithFormat:@"maps.apple.com/maps?saddr=&daddr=%@,%@",destinationLatitude,destinationLongitude];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
如果您使用的是swift 2.2:

    var string = "http://maps.apple.com/?saddr=&daddr=\(destinationLatitude),\(destinationLongitude)"
    UIApplication.sharedApplication().openURL(NSURL(string: string)!)
如果您使用的是swift 3.0:

    var string = "http://maps.apple.com/?saddr=&daddr=\(destinationLatitude),\(destinationLongitude)"
    UIApplication.shared.openURL(URL(string: string)!)

如果您使用的是objective-c:

    NSString *urlString = [NSString stringWithFormat:@"maps.apple.com/maps?saddr=&daddr=%@,%@",destinationLatitude,destinationLongitude];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
如果您使用的是swift 2.2:

    var string = "http://maps.apple.com/?saddr=&daddr=\(destinationLatitude),\(destinationLongitude)"
    UIApplication.sharedApplication().openURL(NSURL(string: string)!)
如果您使用的是swift 3.0:

    var string = "http://maps.apple.com/?saddr=&daddr=\(destinationLatitude),\(destinationLongitude)"
    UIApplication.shared.openURL(URL(string: string)!)

这很有效。对于google maps,您无法添加saddr参数并将正常工作,apple方式有点愚蠢,当前位置应为默认位置,但您需要写入当前%20位置。谢谢,我同意。苹果在这方面有点落后于时代。没问题-很高兴能为您提供帮助。非常感谢您的回答。我不知道当前的%20Location参数值。在调用“地图”获取导航方向之前,我试图先从带有地理位置插件的Cordova/Ionic应用程序中获取位置。这个好多了。谢谢谷歌:苹果:测试过了。这很有效。对于google maps,您无法添加saddr参数并将正常工作,apple方式有点愚蠢,当前位置应为默认位置,但您需要写入当前%20位置。谢谢,我同意。苹果在这方面有点落后于时代。没问题-很高兴能为您提供帮助。非常感谢您的回答。我不知道当前的%20Location参数值。在调用“地图”获取导航方向之前,我试图先从带有地理位置插件的Cordova/Ionic应用程序中获取位置。这个好多了。谢谢谷歌:苹果:测试过了。