MKMapItem with a specific location

How can I launch the default map app for iOS6 and pass it a custom location?

For example:

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

I followed the example here, but could not figure it out. How to launch iPhone application for Google Maps from own native application?

+10
objective-c iphone xcode mkmapitem
Oct 02
source share
1 answer

Here is the code to open the custom Maps app 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]; 
+33
09 Oct '12 at 5:40
source share



All Articles