簡體   English   中英

Titanium facebook喜歡按鈕

[英]Titanium facebook like button

我嘗試從我的Titanium Alloy應用程序發布類似於頁面的內容。

var fb = require('facebook');
fb.appid = "1234567890";
fb.permissions = ['public_profile', 'email', 'publish_actions'];

fb.addEventListener('login', function(e) {
    if (e.success) {
        Ti.API.info('LOGIN : Logged In');
    } else if (e.error) {
        Ti.API.info('LOGIN : ' + e.error);
    } else if (e.cancelled) {
        Ti.API.info('LOGIN : Canceled');
    }
    publishLike();
});

function publishLike() {
    var dict = {
        access_token : fb.getAccessToken()
    };
    fb.requestWithGraphPath('/' + 'somePageId' + '/likes', dict, 'POST', function(e) {
        if (e.success) {
            Ti.API.info('publishLike : Success!');
        } else {
            if (e.error) {
                Ti.API.info('publishLike : ' + e.error);
            } else {
                Ti.API.info('publishLike : Unkown result');
            }
        }
    });
}

但是當應用程序進行API調用時出現錯誤:

[ERROR] :  FacebookModule: (Thread-1559) [9475,21411] Request error for '/somePageId/likes' call: (#3) Application does not have the capability to make this API call.
[ERROR] :  FacebookModule: com.facebook.android.FacebookError: (#3) Application does not have the capability to make this API call.
[ERROR] :  FacebookModule:  at com.facebook.android.Util.parseJson(Util.java:303)
[ERROR] :  FacebookModule:  at facebook.TiRequestListener.onComplete(TiRequestListener.java:88)
[ERROR] :  FacebookModule:  at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:276)
[INFO] :   publishLike : (#3) Application does not have the capability to make this API call.

你有什么想法如何發布?

根據這個答案,你不能喜歡Graph API中的頁面。 這是因為您只能使用API​​的Open Graph對象,但頁面不是Open Graph對象。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM