Skip to content

Instantly share code, notes, and snippets.

@inailuy
Created February 15, 2013 22:51
Show Gist options
  • Save inailuy/4964249 to your computer and use it in GitHub Desktop.
Save inailuy/4964249 to your computer and use it in GitHub Desktop.
Open maps application in iOS with a location within a app.
NSString *mapsURL = @"http://maps.google.com/maps?q=";
if ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue] >= 6) // if iOS 6 or greater use apple maps
{
mapsURL = @"http://maps.apple.com/maps?q=";
}
NSString *mapaddress = [mapsURL stringByAppendingString:address];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[mapaddress stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment