iProgrammed
iProgrammed

Reputation: 980

URL Scheme is Installed in iOS

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.

Upvotes: 0

Views: 2353

Answers (1)

Jingwei
Jingwei

Reputation: 755

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://"]];

Upvotes: 7

Related Questions