0
votes

I have problem sharing a link on Facebook in my app made with Appcelerator

I’m using iOS 11 Simulator, Titanium SDK 7.1 and Facebook Module 5.8. My tiapp.xml should be correct. The facebook app is not installed on the simulator.

My code is:

var fb = require('facebook');
fb.initialize();

function shareLink() {
    fb.addEventListener('shareCompleted', onShareCompleted);

    fb.presentShareDialog({
        link: "http://www.google.com"
    });

}


function onShareCompleted(e){
    fb.removeEventListener('shareCompleted', onShareCompleted);

    if (e.success) Ti.API.info('Share request succeeded.');
    else Ti.API.info('Failed to share.' + JSON.stringify(e));
}

When I try to share, the app show me a webpage of facebook with the error “The parameter ‘href’ or ‘media’ is required”.

If I switch the Facebook module from version 5.8 to 5.6, the first time I try to share, it fails, but the second time it work!

I can’t understand where I’m wrong.

Thanks for any help!

1

1 Answers