How to detect if Facebook app is installed on iOS?
17,358
Solution 1
BOOL isInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]
if (isInstalled) {
} else {
}
Solution 2
Try just using the canOpenURL:
function
NSURL *fbURL = [NSURL URLWithString:@"fb://"];//or whatever url you're checking
if ([[UIApplication sharedApplication] canOpenURL:fbURL])
{
//open it etc
}
Related videos on Youtube
Author by
Tom Kincaid
Updated on October 31, 2020Comments
-
Tom Kincaid over 3 years
On iOS, you can launch the Facebook app and link to a profile by opening a url like this: fb://profile/12345
The only problem is that if the Facebook app isn't installed, nothing happens.
Is there a way to detect if the app is installed or if the url scheme fb:// is supported?
This would apply broadly to other apps like Twitter as well.
-
TharakaNirmana almost 8 years
-
-
rmaddy over 10 yearsDon't encourage duplicate questions.
-
Tommy Devoy over 10 yearsI wrote it before I saw the closure votes. Good call, I'll vote as well
-
Borut Tomazin over 8 yearsYou also need to include LSApplicationQueriesSchemes key into info.plist for iOS 9 with value "fb".