cocos2d-x / plugin-x

Plugin-x is the plugin repository for cocos2d-x, it also provides a unified API for plugins.
71 stars 91 forks source link

Facebook share #134

Open CrastaDaryl opened 9 years ago

CrastaDaryl commented 9 years ago

when FB apps present sharing gives the following message share: { "error_message" : "Failed to generate preview for user."} share result ret: 1

how to fix?

CrastaDaryl commented 9 years ago

what should the preview_property and action_type be when sharing open graph objects, should i also create action types and object under my app if it runs only on iOS and android ?

kimnamcham commented 9 years ago

I have created the open graph in my app. But i got the same problems, here is my code:

FacebookAgent::FBInfo params; params.insert(std::make_pair("dialog", "shareOpenGraph")); params.insert(std::make_pair("action_type", "hbirdgame:Test")); params.insert( std::make_pair("preview_property_name", "cocos_document")); params.insert(std::make_pair("title", "Cocos2d-x Game Engine")); params.insert( std::make_pair("image", "http://files.cocos2d-x.org/images/orgsite/logo.png")); params.insert( std::make_pair("url", "http://cocos2d-x.org/docs/catalog/en")); params.insert(std::make_pair("description", "cocos document")); params.insert(std::make_pair("object_type","hbirdgame:Project"));

    if (FacebookAgent::getInstance()->canPresentDialogWithParams(params)) {
        FacebookAgent::getInstance()->dialog(params,
                [=](int ret ,std::string& msg) {
                    callbackInfo->setString(msg.c_str());
                });
    }