Reputation: 59
I am implementing the screenshot share in facebook using cocos2dx.Login screen in facebook is coming up but photo share is not showing the dialog. Where is my mistake in the below code?? I refer to this site "http://sdkbox-doc.github.io/en/plugins/facebook/v3-cpp/#usage" I am importing all facebook freamwork and sdk freamwork into the project.And facebookListner is not allow .
I implemented the below code :
void HelloWorld::afterCaptured(bool succeed, const std::string& outputFile)
{
if (succeed) {
checkFaceBookStatus();
cocos2d::__String *str =String::create(outputFile);
if(sdkbox::PluginFacebook::isLoggedIn())
{
sdkbox::PluginFacebook::requestPublishPermissions({FB_PERM_PUBLISH_POST});
PluginFacebook::FBAPIParam params;
PluginFacebook::api("me", "GET", params, "me");
sdkbox::FBShareInfo info;
info.type = sdkbox::FB_LINK;
info.link = "http://www.cocos2d-x.org";
info.title = "cocos2d-x";
info.text = "Best Game Engine";
info.image = str->getCString();
sdkbox::PluginFacebook::share(info);
CCLOG("My Photo %d",sdkbox::PluginFacebook::isLoggedIn());
}
else
{sdkbox::PluginFacebook::login();
}}
static void checkFaceBookStatus()
{
CCLOG("##FB> permission list: ");
for (auto& permission : PluginFacebook::getPermissionList())
{
CCLOG("##FB>> permission %s", permission.data());
}
CCLOG("##FB> access token: %s", PluginFacebook::getAccessToken().c_str());
CCLOG("##FB> user id: %s", PluginFacebook::getUserID().c_str());
CCLOG("##FB> FBSDK version: %s", PluginFacebook::getSDKVersion().c_str());
}
Logcat displays:
access token:
CAAXYnG02SHABAB4NDrDbNVBoUeZAPRsTZBxlJEjeT77RSHIfCVMDrdDP6ZB3hyu2BOZCMwVhB4wfNgZBdHmYCOe7T9F0tupf60MObtRPyL5Pr3AL3TtpcmbQ0jZBRk1KBb0ZA0O8WdkRXBsCdxZBncprUNVuUrZAkUSdZAbtiwAXbpujbNc69VFEIqVwR7BmzfukHCm5hUYhDkHd0WZCN4UfUqmIZCB8CWIvCuAVARZAdi9RZCTAZDZD
##FB> user id: 771136763011945
##FB> FBSDK version: 4.5.1
2015-09-25 18:22:34.827 DressMeUp-mobile[8302:165074] FBSDKLog: starting with Graph API v2.4, GET requests for /me should contain an explicit "fields" parameter
My Photo 1
2015-09-25 18:25:18.803 DressMeUp-mobile[8302:165074] FBSDKLog: starting with Graph API v2.4, GET requests for /me should contain an explicit "fields" parameter
Upvotes: 1
Views: 731
Reputation: 2553
One of the main changes in v2.4 of the Graph API is that the number of default fields returned for most Graph API calls have been reduced to help improve performance on mobile network connections.
In v2.4 you will need to declaratively list the response fields for your calls i.e. you should now use the ?fields=field1,field2 syntax to declare all the fields you want the API to return. In your case the syntax will be different but the concept is the same.
You can read more here:
https://developers.facebook.com/docs/apps/upgrading#v23tov24 https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Upvotes: 2