简体   繁体   中英

Facebook iOS SDK - what is the right way to set up the controller

I tried to integrate Facebook in my iOS app, using the new Facebook iOS SDK. I managed to authorize the app I created on Facebook, but after the iOS app reloads (after logging in), delegates like -(void)fbdidload don't get called.

The controller I am using is presented modally at some point in my app. Could this be the problem? Which is the right way to set up the controller? I am quite convince this is the problem, because this is the only difference between my app and the demo app they provided. Please help.

Make sure your class is a FBSessionDelegate, and when you authorize your app make sure you set yourself as the delegate.

These are the callbacks after logging in:

/**
 * Called after user has logged in.
 */   
- (void)fbDidLogin{
}

/**
 * Called when the user dismissed the dialog without logging in.
 */
- (void)fbDidNotLogin:(BOOL)cancelled{
}

If it is not switching back to your app follow the instructions to add your app id to the info.plst

The last thing that needs to be accomplished to enable SSO support is a change to the .plist file that handles configuration for the app. XCode creates this file automatically when the project is created. A specific URL needs to be registered in this file that uniquely identifies the app with iOS. Create a new row named URL types with a single item, URL Schemes, containing a single value, fbYOUR_APP_ID (the literal characters fb followed by your app id).

http://developers.facebook.com/docs/guides/mobile/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM