问题
How can I launch the default maps app for iOS6 and pass it a custom location?
For example:
[[MKMapItem setLocation:MyLocation] openInMapsWithLaunchOptions:nil];
I followed the example here, but was unable to figure it out. How can I launch the Google Maps iPhone application from within my own native application?
回答1:
Here is the code to open the Maps native application with a custom location:
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];
来源:https://stackoverflow.com/questions/12692924/mkmapitem-with-specific-location