Here you have a way to open the Google Maps website or the Google Maps application using the marker on it.
- (void) onPositionPressed:(UITapGestureRecognizer*)sender{ NSNumber * latitude = [sender.view associativeObjectForKey:@"latitude"]; NSNumber * longitude = [sender.view associativeObjectForKey:@"longitude"]; if(latitude && longitude){ //Abrimos Google Maps... if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps://"]]) { [[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"comgooglemaps://?q=%.6f,%.6f¢er=%.6f,%.6f&zoom=15&views=traffic", [latitude doubleValue], [longitude doubleValue], [latitude doubleValue], [longitude doubleValue]]]]; } else { [[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"https://maps.google.com/maps?&z=15&q=%.6f+%.6f&ll=%.6f+%.6f", [latitude doubleValue], [longitude doubleValue], [latitude doubleValue], [longitude doubleValue]]]]; } } }
In this case, latitude and longitude are NSNumbers, but you can use regular double vars.
I hope this helps anyone;)
source share