Search code examples
titaniumtitanium-mobiletitanium-modules

Titanium Facebook Dialog does not appear


Im developing an "share on facebook" button.

But there is a problem, the facebook dialog is not prompted to the user.

I have tried the sample that titanium provide:

function facebook(){

    var fb = require('facebook');

    var data = {
        link : "http://www.appcelerator.com",
        name : "Appcelerator Titanium Mobile",
        message : "Checkout this cool open source project for creating apps",
        caption : "Appcelerator Titanium Mobile",
        picture : "http://developer.appcelerator.com/assets/img/DEV_titmobile_image.png",
        description : "You've got the ideas, now you've got the power."
    };

    fb.dialog("feed", data, function(e) {

            var toast = Ti.UI.createNotification({
            message:"Default",
            duration: Ti.UI.NOTIFICATION_DURATION_LONG
        });

            if(e.success && e.result) 
                toast.message = "Success! New Post ID: " + e.result;
            else {
                if(e.error) 
                        toast.message = e.error;
                else 
                    toast.message = "User canceled dialog.";
            }
        toast.show();
    });
}

The function is called correctly, but nothing appear.

Someone knows why? Maybe permissions? But i have read that for the dialog aren't required permissions!

thanks to all


Solution

  • I solved by myself! Even if the Facebook Dialog not Require the Auth(), it require the init with an AppID.

    var fb = require('facebook');
    fb.appid = your_app_id_number;
    

    With this worked very well.