![](/img/trans.png)
[英]How can I launch the Google Maps iPhone application from within my own native application?
[英]Launch Google maps app from iPhone application.
我正试图从我的iPhone应用程序启动谷歌地图。
发布部分工作正常,但自iPhone 3.1更新(我认为这是在这个时间)后,我得到了美国和加拿大的缩小地图,而不是放大我当前的位置。 一切都工作正常,但有时候更新的东西停止正常工作。
这是我一直在使用的字符串。 这适用于我的合作伙伴手机iOS 3.0和我们的iPod与iOS 2.2.1,但我的手机与iOS 3.1显示缩放的加拿大和美国地图。
NSString *name = @"clothing";
NSString *latlong = [[NSString alloc] initWithFormat:@"%@,%@", latitudeString, longitudeString];
NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?q=%@&mrt=yp&ll=%@",
[name stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
[latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
[latlong release];
任何帮助是极大的赞赏。
提前致谢。
这是我在我的一个应用程序中使用的代码,它可以正常使用3.1。 此处记录了Google地图的参数。
CLLocationCoordinate2D stationLocation = ...
NSString *urlString = [[NSString alloc]
initWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirflg=d",
curLocation.latitude,
curLocation.longitude,
stationLocation.latitude,
stationLocation.longitude];
NSURL *aURL = [NSURL URLWithString:urlString];
[urlString release];
[[UIApplication sharedApplication] openURL:aURL];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.