0

I am Integrating Google Maps URL Scheme in my Application:

[[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@"comgooglemaps://"]];

I am curios if there is some code to detect if Google Map isn't installed and redirect to App Store URL. Thanks for your Help.

iProgrammed
  • 980
  • 2
  • 10
  • 29

1 Answers1

7

If it return true, that means the Google Map app has been installed.

if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]])
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/en/app/google-maps/id585027354?mt=8"]];
else
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"comgooglemaps://"]];
Jingwei
  • 745
  • 9
  • 22