pepeek
August 5, 2015, 5:57pm
1
I followed guide http://sdkbox-doc.github.io/en/plugins/facebook/v3-js/
in brand new project and received this error: ReferenceError: FB_PHOTO is not defined
My code fragment is:
menuClicked :function () {
cc.log("Pp: CALLED: menuClicked!");
var path = jsb.fileUtils.fullPathForFilename("res/HelloWorld.png");
var isThere = jsb.fileUtils.isFileExist(path);
cc.log("Pp: menuClicked: isThere="+isThere + "; path="+path);
this.shareCallback(path);
},
shareCallback :function (path) {
cc.log("Pp: CALLED: shareCallback!");
// SDKBOX: FB
var info = new Object();
info.type = FB_PHOTO;
info.title = "My Photo";
info.image = path;
sdkbox.PluginFacebook.dialog(info);
},
BTW, the path is likely not correct because is not a true full path. Any hint where to get the very full path?
I need this only for the test.
My console output:
D/cocos2d-x debug info(18067): JS: Pp: CALLED: menuClicked!
D/cocos2d-x debug info(18067): JS: Pp: menuClicked: isThere=true; path=assets/res/HelloWorld.png
D/cocos2d-x debug info(18067): JS: Pp: CALLED: shareCallback!
D/cocos2d-x debug info(18067): JS: assets/src/app.js:95:ReferenceError: FB_PHOTO is not defined
Thanks!
nite
August 5, 2015, 7:12pm
2
Can you try
var info = new Object();
info.type = 2;
info.title = "My Photo";
info.image = path;
sdkbox.PluginFacebook.dialog(info);
typo
var info = new Object();
info.type = "photo";
info.title = "My Photo";
info.image = path;
sdkbox.PluginFacebook.dialog(info);
and here is a typo erro, edit PluginFacebookJSHelper.cpp line 150, replace with
info.text = dict.find("text")->second;
pepeek
August 6, 2015, 10:04am
4
It was helpful and it shifted me a bit forward. Now I see this in the log:
D/FacebookSDK.Request(20383): Request:
D/FacebookSDK.Request(20383): Id: 4
D/FacebookSDK.Request(20383): URL: https://graph.facebook.com/v2.4/1622986447923292/activities?access_token=&format=json&sdk=android
D/FacebookSDK.Request(20383): Method: POST
D/FacebookSDK.Request(20383): User-Agent: FBAndroidSDK.4.4.0
D/FacebookSDK.Request(20383): Content-Type: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
D/FacebookSDK.Request(20383): Parameters:
D/FacebookSDK.Request(20383): format: json
D/FacebookSDK.Request(20383): sdk: android
D/FacebookSDK.Request(20383): Attachments:
D/FacebookSDK.Request(20383): custom_events_file: <Data: 298>
D/FacebookSDK.Request(20383): application_package_name: cz.volten.brili.android.free
D/FacebookSDK.Request(20383): advertiser_tracking_enabled: true
D/FacebookSDK.Request(20383): extinfo: ["a2","cz.volten.brili.android.free",1,"1.0","4.4.2","K013","en_US","CEST","",1280,736,"1.33",4,11,11]
D/FacebookSDK.Request(20383): anon_id: XZd1569196-5350-4ea5-9203-d87fea674d73
D/FacebookSDK.Request(20383): application_tracking_enabled: true
D/FacebookSDK.Request(20383): event: CUSTOM_APP_EVENTS
D/FacebookSDK.Request(20383): advertiser_id: ff4c2177-f583-4607-8d68-3506e2cc8e8b
D/FacebookSDK.Request(20383): attribution: eabbae6f-1c54-4512-b20e-a70f74bc1c68
D/FacebookSDK.Response(20383): Response
D/FacebookSDK.Response(20383): Id: 4
D/FacebookSDK.Response(20383): Size: 16
D/FacebookSDK.Response(20383): Responses:
D/FacebookSDK.Response(20383): [{Response: responseCode: 200, graphObject: {"success":true}, error: null}]
It seems all good, but the FB dialog does not open!
The other samples works good…
pepeek
August 11, 2015, 3:48pm
6
You are correct. I had FB app installed but for some reason it did not for with the API. I’ve updated the app and the dialog works as expected. I would be nice to have API feedback on missing/not_functioning FB application just like the legacy FB plugin did. Thanks!
I had the same problen in C++:
I used this:
sdkbox::FBShareType::FB_PHOTO;
may be you need sdkbox.FBShareType.FB_PHOTO
pepeek
August 12, 2015, 8:20am
8
Thanks, this is already solved in JS thanks to @yinjimmy