aramusss aramusss - 2 months ago 32
iOS Question

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

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
? Thank you in advance.


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