Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2k forks source link

FB share not working on some iOS devices #1356

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi just a problem with iOS,

tried to use the plugin to share something from our app. I used iphone 6+ with 10.3.2 ios version and the share to fb function works. however when i ran the same app, on an iphone 5s or 6, everytime i share something, it prompts to the "login with fb dialog" instead of automatically sharing it to facebook (which should return a "facebook posting success" message upon success). On the console it just says user cancelled (which I believe comes from the plugin). Any ideas?

plugin : cordova-plugin-facebook4 1.7.4 "Facebook Connect" ios version on both devices : 10.3.2 fb app version: 100.0 ionic v: 3.5.0

here is the method : `function post_to_facebook(data) { $log.log('Posting to facebook', data);

    // Check user fbplugin login status 
    facebookConnectPlugin.getLoginStatus(
    function(response){
        if(response.status == 'connected') {
            // post to facebook
            var facebookString = "/me/photos?method=post&url=" + data.twitter_picture + "&caption=" + encodeURIComponent(data.desc) + "&access_token="+response.authResponse.accessToken;
            $cordovaFacebook.api(facebookString, ["publish_actions"])
            .then(function (result) {
                console.log(result);
                loading('hide');
                toast("facebook posting success");
            },
            function (error) {
                console.log(error);
                loading('hide');
                toast("facebook posting failed");
            })
        }
        else {
            loading('hide');
            toast("facebook posting failed");
            return;
        }
    },
    function(response){
        loading('hide');
        toast("can not post to facebook");
        console.log(response);
        return;
    });
}`