[Solved]Invite Friends with using cocos2dx layer

Hi everyone,

I’m trying to create a invite friends layer, i’m using PluginFacebook::requestInvitableFriends to get friends list, but the callback FBInvitableFriendsInfo friends is always empty, it doesn’t even contain original string data.

I read the sdkbox document and it mention that “custom invite dialog is only available for games with a canvas implementation for the Facebook application” <= is this mean this only work if my game is canvas/html 5? how about game on native platform?

If i use PluginFacebook::inviteFriends(); -> the dialog with friend list still show correctly

@nite sorry tagging you in like this, my problem is a bit rush :blush:?

this is what my code look like:

FBAPIParam params;
PluginFacebook::requestInvitableFriends(params);

void InviteLayer::onRequestInvitableFriends( const sdkbox::FBInvitableFriendsInfo& friends ){
for (auto ite = friends.begin(); ite != friends.end(); ite++) {
CCLOG("---------------");
CCLOG(“name = %s”, ite->getName().c_str());
CCLOG(“user id = %s”, ite->getUserId().c_str());
CCLOG(“picture url = %s”, ite->getPictureURL().c_str());
}
CCLOG(“the next url = %s”, friends.getNextURL().c_str());
CCLOG(“num token = %u”, friends.getNumInvitationTokens());
CCLOG(“the next cursor = %s”, friends.getNextCursor().c_str());
CCLOG(“the original string = %s”, friends.getOriginalString().c_str());
}

Yes you need a canvas version of your game, but you can submit an empty/placeholder canvas version.

THanks you this solved like you said

Hi @nite
I’ve the same problem. The callback FBInvitableFriendsInfo friends is always empty.
How can I set a canvas for my app? I didn’t find it in my facebook developer panel. I’m testing it on iOS with FB Tester users.

Hi all,
I updated the facebook doc about the inviting friends
http://docs.sdkbox.com/en/plugins/facebook/v3-cpp/#invite-friends

Thanks,

I need obtain friend-list of a user, through the method onRequestInvitableFriends.
My problem is the callback FBInvitableFriendsInfo friends is always empty.

Filling “Facebook web games” URL I solve the problem? If yes, what url I should complete there? My game are not online. I don’t have App Store or Google Play URL…

1 Like