4

Description

When the Facebook app is not installed, canShareVia method should invoke the error callback, which is working perfectly with my iPhone5s running iOS 10.

When I test it on iPhone5s running iOS 11.2, it is always invoking the success callback in both the cases where the Facebook app is installed and Not installed.

App

A Cordova mobile app

Plugin: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

Device information

  • iPhone 5s
  • iOS 11.2
  • Facebook app: Not installed

Sample code

window.plugins.socialsharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null, 
function(success) {
   do some stuff....
}, function(error) {
   alert(error); 
});

Please let me know if any work around has been found.


Updated

Found the cause:

This plugin always returns true since iOS11. So we might need another way to detect if there is an app installed and available.

Raj Kumar
  • 953
  • 1
  • 8
  • 19

2 Answers2

2

Get it to work with cordova-plugin-appavailability.

You can implement this way (Appavailability plugin to check Facebook app availability and social sharing plugin to do the actual sharing).

appAvailability.check(
    'fb://',
    function() {  // Success callback
        window.plugins.socialsharing.shareViaFacebook(...)
    },
    function() {  // Error callback
        console.log('Facebook App is not available');
    }
);

Though this is a work around but not a fix, this is the only way for now until the fix gets merged to cordova-plugin-x-socialsharing.

Raj Kumar
  • 953
  • 1
  • 8
  • 19
2

You can find the answer for your question here. App Availability. Read this and your requirement will be piece of cake.

Karthik
  • 1,088
  • 6
  • 17