检查iOS 6中是否安装了Google地图应用 [英] Check if Google Maps App is installed in iOS 6

查看:128
本文介绍了检查iOS 6中是否安装了Google地图应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何处理此代码的结果,看看应用中是否安装了Google地图。

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

我创建一个 UIAlertView 在那里,如果是或不是我想给用户不同的选择。

I am creating a UIAlertView 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?

提前感谢。

推荐答案

canOpenURL: 一个布尔值:

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?
}

这篇关于检查iOS 6中是否安装了Google地图应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆