如何启动iOS6的默认 map 应用并将其传递给自定义位置?

例如:

[[MKMapItem setLocation:MyLocation] openInMapsWithLaunchOptions:nil];

我在这里按照示例进行操作,但无法弄清楚。 How can I launch the Google Maps iPhone application from within my own native application?

最佳答案

以下是使用自定义位置打开Maps native 应用程序的代码:

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];

关于objective-c - 具有特定位置的MKMapItem,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12692924/

10-11 07:16