shailesh Parkhi
shailesh Parkhi

Reputation: 23

How to check fb app is installed on iPad?

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

if (isInstalled) {

} else {

}

Above code working fine with iPhone but not iPad.

Upvotes: 1

Views: 1522

Answers (1)

Anbu.Karthik
Anbu.Karthik

Reputation: 82766

First, you'll need to 'whitelist' the URL by adding the following to your Info.plist file

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

and check

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

Upvotes: 7

Related Questions