Jeff Kranenburg Jeff Kranenburg - 1 year ago 251
iOS Question

Check if Google Maps App is installed in iOS 6

I am trying to figure out how to handle the result of this code to see if Google Maps is installed in the app.

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

I am creating a
with the option in there and if it is or isn't I wish to give the user different options.

How do I take the result of the code above and turn it into a BOOLEAN?

Thanks in advance.

Answer Source

The result is already of canOpenURL: a boolean:

BOOL canHandle = [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps:"]];

if (canHandle) {
   // Google maps installed
} else {
   // Use Apple maps?
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download