Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if user has Facebook Messenger installed iOS 9

Facebook has deprecated the method [FBSDKMessengerSharer messengerPlatformCapabilities] that is used to check if the user has Messenger app installed. In the warning message, it says:

messengerPlatformCapabilities is deprecated: This is deprecated as of iOS 9. If you use this, you must configure your plist as described in https://developers.facebook.com/docs/ios/ios9

I would like to remove this method, but haven't found any other option to replace this code (that makes a button disabled if user hasn't Messenger app installed):

if (![FBSDKMessengerSharer messengerPlatformCapabilities]) {
    [self.inviteFriendsButton setEnabled:NO];
    [self.inviteFriendsButton setAlpha:0.5f];
}

Is there any other method? Or, as new iOS requirements I should avoid using this if? Thank you in advance.

like image 750
aramusss Avatar asked Sep 22 '15 09:09

aramusss


People also ask

How do I open Facebook Messenger on my Device?

Further, if you have the Messenger app installed on your device, it will automatically open when you tap the icon. Go to www.facebook.com on your browser and click the Messenger icon at the top right → click the search field and type in what you’re looking for.

How can I find out if someone is on Facebook Messenger?

Ask them. Otherwise you don’t. It’s none of your business. It’s also a federal crime to find out without their consent. How can I tell when someone is on Facebook with the Messenger app? If your on the messenger app you can see everyone that's active as their chat heads will have a green dot. They don't have to be active on Facebook.

Can Google tell if you don’t have messenger on your phone?

Nope. But Google is able to tell if you don’t have the Messenger app on your Android phone or any other apps for that matter—if you use iOS, then Apple should know that too. That is why on Play Store or AppStore, the button on the app pages changed from “Uninstall” to “Install” after you removed the app from your phone.

Is Messenger a part of Facebook?

Yes, it is part of Facebook and since May of this year will be the Messaging platform used by all the apps owned by facebook including Snap, Instagram and Whatsapp. I uninstalled the messenger app yesterday, why can people still message me? Oh dear.


1 Answers

You will want to use canOpenURL to see if the Custom URL Scheme fb-messenger:// can be opened. canOpenURL returns a BOOL value indicating whether or not the URL’s scheme can be handled by some app installed on the device. If canOpenURL returns YES then the application is present on the device.

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb-messenger://"]]) {
    // Installed
    [self.inviteFriendsButton setEnabled:YES];
    [self.inviteFriendsButton setAlpha:1.0];
}
else {
    // NOT Installed
    [self.inviteFriendsButton setEnabled:NO];
    [self.inviteFriendsButton setAlpha:0.5];
}

Also, starting at iOS 9 you must include LSApplicationQueriesSchemes in your info.plist.

enter image description here

like image 148
Daniel Storm Avatar answered Sep 24 '22 06:09

Daniel Storm