OK, this is how I do this integration with iOS 6 and get what I want from Facebook:
In AppDelegate, I do this:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [FBSession.activeSession handleOpenURL:url]; } - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSession.activeSession handleDidBecomeActive]; } - (void)applicationWillTerminate:(UIApplication *)application { [FBSession.activeSession close]; }
and in my ViewController, where I want to get information about myself or my friends, I do this (NOTE: this is a test, so you have many permissions!):
NSArray *permissions = [NSArray arrayWithObjects:@"email", @"user_location", @"user_birthday", @"user_likes", @"user_interests",@"friends_interests",@"friends_birthday",@"friends_location",@"friends_hometown",@"friends_photos",@"friends_status", @"friends_about_me", @"friends_birthday", @"friends_hometown", @"friends_interests", @"friends_likes", @"friends_location", nil]; [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { if (status) { NSLog(@"Facebook Read Permission is successful!"); [self presentPostOptions];
Then in "presentPostOptions" I do this (in this example, I'm trying to extract something from my friend):
- (void)presentPostOptions { [[FBRequest requestForMyFriends] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) { if (!error) { NSArray *data = [user objectForKey:@"data"]; NSLog(@"%d", [data count]); for (FBGraphObject<FBGraphUser> *friend in data) { NSLog(@"%@", [friend first_name]); NSLog(@"%@", [friend last_name]); NSLog(@"%@", [friend id]);
I don’t know what else you want to do, because in your question you were just trying to establish a connection, but in this way you can do whatever you want while you are integrated into iOS 6.
One more thing, make sure that you have the application settings via Facebook and the settings there, how to enable the application for iOS and ID for iPhone / iPad. Also FacebookAppID in your plist.
Let me know if this works for you,
EDIT: btw my Facebook SDK - 3.1.1.