我正在使用cocos2dx在facebook中实现屏幕截图分享。脸谱中的登录屏幕即将出现,但照片共享未显示对话框。我在下面的代码中的错误在哪里?我指的是这个网站“http://sdkbox-doc.github.io/en/plugins/facebook/v3-cpp/#usage” 我将所有facebook freamwork和sdk freamwork导入到项目中。并且不允许使用facebookListner。
我实现了以下代码:
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显示:
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
答案 0 :(得分:1)
Graph API v2.4的主要变化之一是,大多数Graph API调用返回的默认字段数已减少,以帮助提高移动网络连接的性能。
在v2.4中,您需要以声明方式列出调用的响应字段,即您现在应该使用?fields = field1,field2语法来声明您希望API返回的所有字段。在您的情况下,语法将不同,但概念是相同的。
您可以在这里阅读更多内容:
https://developers.facebook.com/docs/apps/upgrading#v23tov24 https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/