繁体   English   中英

iPhone:如何从您的应用程序在Google Maps API中启动路线

[英]Iphone: how to launch a route in google maps api from your application

我读了很多话题,但是我什么时候都找不到

我想从我的应用程序中启动google map api:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"]]

但这是带有Google地图页面的开放式野生动物园。 我想用自己的路线打开Goog​​le map API。 有maps://或其他东西吗?

感谢帮助 !!!

尝试这个

    UIApplication *app = [UIApplication sharedApplication];

    NSURL *url = [[NSURL alloc] initWithString: @"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"];

    [app openURL:url];

    [url release];

看看Apple URL Scheme Reference for MapLinks

编辑:您的网址看起来正确。 看来您正在模拟器上测试! GoogleMaps应用仅在设备上可用!

尝试这个

NSString *urlstring=[NSString stringWithFormat:@"http://maps.google.com/?&saddr=%@ &daddr=%@",sourceaddress,destinationaddress];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM