如何在iPad上安装fb app?

时间:2016-08-25 06:32:15

标签: ios objective-c ipad

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

if (isInstalled) {

} else {

}

以上代码适用于iPhone但不适用于iPad。

1 个答案:

答案 0 :(得分:6)

首先,您需要将白名单'通过将以下内容添加到Info.plist文件

来创建URL
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

并检查

 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
    // Facebook app is installed
}else
{
 // not installed
 }