Reputation: 27133
I use this code for opening maps app
NSString* versionNum = [[UIDevice currentDevice] systemVersion];
NSString *nativeMapScheme = @"maps.apple.com";
if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending){
nativeMapScheme = @"maps.google.com";
}
NSString* url = [NSString stringWithFormat:@"http://%@/maps?ll=%f,%f", nativeMapScheme, 40.739490, -73.991154];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
Seems it works good, but there is no pin on this location I use. How to add pin, I suppose there is additional parameters in request?
Upvotes: 9
Views: 2913
Reputation: 2525
If you want the pin to be placed on Apple's Maps app, use a 'q' instead of 'll' in the URL.
You can Use like this
NSString* url = [NSString stringWithFormat:@"http://%@/maps?q=%f,%f", nativeMapScheme, 40.739490, -73.991154];
Upvotes: 12