[SOLVED] Sdkbox how to get user Facebook profile pic?

I am trying to integrate facebook through SDKBOX. I am able to login successfully and get general info in callback “onGetUserInfo( const sdkbox::FBGraphUser& userInfo )”, when I am trying to get my profile picture through “userInfo.getPictureURL()” method, it always returns null json data in the picture field. Is there any specific permission that I need to grant through my facebook developer account? Any help would be appreciated.

Thanks in advance !! :]

   std::string url=StringUtils::format("https://graph.facebook.com/%s/picture?width=200&height=200",faceID.c_str());

   auto sprite = RemoteSprite::createWithURL(url,"res/emptyprofile.png");
    auto viewSize = view->getContentSize();
    sprite->setPosition(viewSize.width / 2, viewSize.height / 2);
    auto spriteSize = sprite->getContentSize();
    float scale = MIN((viewSize.height - 8) / spriteSize.height, (viewSize.width -8) / spriteSize.width);
    sprite->setScale(scale);
    view->addChild(sprite, -1);

view is the frame that hold the profile picture .
download RemoteSprite https://developerhuddle.wordpress.com/2015/02/22/remotesprite-sprite-extension-to-support-server-hosted-graphics-cocos2d-x-c/

1 Like

@Kotaiba Thanks man it worked for me!! :smile: