I'd like to support iOS5 in my app which I compile with the iOS 6.1 SDK.
One functionality is to take the User to the Maps App. Here is a link explaining how to do it with iOS SDK 5 for iOS 5 and also with iOS SDK 6 for iOS 6.
However, if I use iOS 6.1 SDK and use a iOS 5 device, the magic URL link takes me to the maps.google.com Website in Mobile Safari, not the native Maps App, as desired.
Can this be fixed?
EDIT
So far, I have this:
BOOL appleMapsSupported = FALSE;
NSString *reqSysVer = @"6.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
appleMapsSupported = TRUE;
if (appleMapsSupported){
NSLog(@"device version %@", [[UIDevice currentDevice] systemVersion]);
MKPlacemark* placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:@{(NSString*)kABPersonAddressStreetKey:@"Your Place"}];
MKMapItem* mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem openInMapsWithLaunchOptions:@{MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeWalking}];
}else{
NSString* url = [NSString stringWithFormat:@"http://maps.google.com/?t=m&q=Your+Place%%40%g,%g", coordinate.latitude, coordinate.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}