I am attempting to add facebook integration to my ios game built using Cocos2D. I initially just made the CCLayer object (subclass of NSObject) a FBRequestDelegate, FBDialogDelegate, and FBSessionDelegate. Then I created a facebook object with
fb_permissions = [[NSArray arrayWithObjects:
@"read_stream", @"publish_stream", @"offline_access",nil] retain];
facebook = [[Facebook alloc] initWithAppId:kAppId
andDelegate:self];
next I call
[facebook authorize:fb_permissions];
when the user pushes a button. It all works fine, goes to the facebook login page, correctly authorizes my application etc. Once it returns execution to my game, I expected the
- (void)fbDidLogin
method to be called, but it doesn’t seem to be. I’m a little confused and just wondering if I’ve gone about this wrong? Should I implement my facebook sdk stuff in my root viewcontroller? ie. make my viewcontroller the FB delegate?
Is it that I’m missing a call to handleOpenURL? Which appears to be depracated? I’m having trouble locating decent documentation on this particular issue…
thanks!!
I think you will need to implement handleOpenURL in your App Delegate:
Edit: I see that execution returns to your game, so you may have already completed the following:
You will also need to edit your .plist file to handle the return from the authorization page. You will add an entry to
MyApp-info.plistunderFollow the instructions at the end of Step 6 here: http://developers.facebook.com/docs/guides/mobile/#ios