0

After reading this post, Programmatically open Maps app in iOS 6

using the code below, I launch Apple Maps but I just want to open Apple Maps not send an address, place mark or directions to it.

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(44.180383, -75.229618);
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate
                                               addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem setName:@"Home"];
// Pass the map item to the Maps app
[mapItem openInMapsWithLaunchOptions:nil];

Any help would greatly be appreciated.

Community
  • 1
  • 1
OscarTheGrouch
  • 2,374
  • 4
  • 28
  • 39

2 Answers2

1

Use the following code in your application to open just Apple Maps

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://maps.apple.com/?q="]];
Mohammed Shakeer
  • 1,446
  • 16
  • 23
0

Use apples URL schemes

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://maps.apple.com"]];

For more information please refer to apples maps URL sceme documentation: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

Lachlan
  • 312
  • 2
  • 15