如何启动iOS6的默认地图应用并将其传递到自定义位置?
例如:
[[MKMapItem setLocation:MyLocation] openInMapsWithLaunchOptions:nil];
我按照这里的例子,但无法弄明白。 How can I launch the Google Maps iPhone application from within my own native application?
答案 0 :(得分:33)
以下是使用自定义位置打开Maps本机应用程序的代码:
double latitude = 35.0;
double longitude = 1.0;
MKPlacemark *placemark = [[[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) addressDictionary:nil] autorelease];
MKMapItem *mapItem = [[[MKMapItem alloc] initWithPlacemark:placemark] autorelease];
[mapItem setName:@"Name of your location"];
[mapItem openInMapsWithLaunchOptions:nil];