Created
February 15, 2013 22:51
-
-
Save inailuy/4964249 to your computer and use it in GitHub Desktop.
Open maps application in iOS with a location within a app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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