如何检测iOS上是否安装了Facebook应用程序? [英] How to detect if Facebook app is installed on iOS?

查看:135
本文介绍了如何检测iOS上是否安装了Facebook应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS上,您可以通过打开以下网址来启动Facebook应用并链接到个人资料:fb://个人资料/ 12345

On iOS, you can launch the Facebook app and link to a profile by opening a url like this: fb://profile/12345

唯一的问题是如果没有安装Facebook应用程序,没有任何反应。

The only problem is that if the Facebook app isn't installed, nothing happens.

有没有办法检测是否安装了应用程序或是否支持网址方案fb:// ?

Is there a way to detect if the app is installed or if the url scheme fb:// is supported?

这也适用于Twitter等其他应用程序。

This would apply broadly to other apps like Twitter as well.

推荐答案

BOOL isInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]

if (isInstalled) {

} else {

}

这篇关于如何检测iOS上是否安装了Facebook应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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