Error when using facebook with cocos2d-x 3.3 rc0

I try to integrate facebook with cocos2d-x 3.3 rc. I follow this tutorial: http://www.cocos2d-x.org/wiki/Facebook_integration_instruction_for_Cocos2d-x_and_Cocos2d-x-Lua_on_iOS

But I get two problems:
When i added FacebookSDK.framework, I got an error “Not found <FacebookSDK/FacebookSDK.h>”. I found that: DON’T have any header file in “FacebookSDK.framework/Headers” folder. I fixed by copying all header file in “FacebookSDK.framework/Versions/A/Headers” to “FacebookSDK.framework/Headers”. Then this error was fixed. But When i opened Build Settings page, then searched for Other Linker Flags, and added “-ObjC” linker flag. Then I compiled I saw another bug.

Someone can tell me why i get this bug and how to fix it. Thank you.

Add these two framework in your xCode
GameController.framework
MediaPlayer.framework

Thank you. I can use facebook on iOS but when u try on android. It don’t work

please mention what are the problems you are facing for Android.

I follow this post to integrate facebook in cocos2d-x 3.3rc0 on android: http://www.cocos2d-x.org/wiki/Facebook_integration_instruction_for_Cocos2d-x_and_Cocos2d-x-Lua_on_android

But i don’t understand what is different between step 3 and step 8:
Step3: Add plugin-x link lib in proj.android/jni/Android.mk

LOCAL_WHOLE_STATIC_LIBRARIES += PluginProtocolStatic
...
$(call import-module,cocos2d/plugin/protocols/proj.android/jni)

and

LOCAL_STATIC_LIBRARIES += PluginProtocolStatic
...
$(call import-module,plugin/protocols/proj.android/jni)

And i get error in this line:

$(call import-module,cocos2d/plugin/protocols/proj.android/jni)

If I comment that line. Then compile. Game run but when I call function login facebook i still get error

try this

remove facebooksdk.jar, in place of that use the latest facebook android sdk https://developers.facebook.com/docs/android/

add facebook sdk project as a project library.

what is error now?

This is it

can you mention at which point this error is coming, at launch of app or login to facebook or at any other point?

I’ve noticed that in Order and Export tab, jars are included but unchecked. I checked them and the problem is solved -

  • Properties->Java Build Path->Order and Export
  • Check the jars
  • clean
  • build
1 Like

Hoangtaiki, maybe a silly question, but do you have the facebook app installed on the device you’re trying to run on?

Hi guys,

I’m also trying to integrate FB in my game. Using cocos2d-x 3.3 rc0. Are we supposed to copy these header files like this ? Or is there something missing in the release ?

Cheers
Seb

I didn’t copy any headers…

I don’t know why i don’t have any header files. But I have copied and pasted it. And It worked for me. I don’t know why.

Yes. It work for me on both Android and iOS.

use facebook using @sdkbox