Created
August 29, 2013 21:06
-
-
Save RuiAAPeres/6383419 to your computer and use it in GitHub Desktop.
Just a small piece of code to get the basic info + profile picture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (void(^)())facebookImageBlockWithCompletionHandler:(void(^)(id profilePicture, id userInformation, NSError *error))completionHandler | |
| { | |
| void(^facebookBlock)()= ^{[FBSession openActiveSessionWithReadPermissions:@[@"basic_info", @"email"] | |
| allowLoginUI:YES | |
| completionHandler:^(FBSession *session, | |
| FBSessionState status, | |
| NSError *error) | |
| { | |
| if (!error) | |
| { | |
| if (status != FBSessionStateOpen) | |
| { | |
| // Don't do anything, just return it | |
| return; | |
| } | |
| [FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *userInfoConnection, id userInfo, NSError *error1) | |
| { | |
| [FBRequestConnection startWithGraphPath:@"me?fields=picture.type(large)" completionHandler:^(FBRequestConnection *userPictureConnection, id profilePicture, NSError *errorr2) | |
| { | |
| if(errorr2) | |
| { | |
| completionHandler(nil,nil,error); | |
| } | |
| else | |
| { | |
| completionHandler(profilePicture,userInfo,nil); | |
| } | |
| }]; | |
| }]; | |
| } | |
| else | |
| { | |
| completionHandler(nil,nil,error); | |
| } | |
| }];}; | |
| return facebookBlock; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment