Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FBRequest *req = [FBRequest requestForMe];
- [req startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *result, NSError *error) {
- if (!error)
- {
- [[VSFacebook sharedFacebook] setFbUser:result];
- FriendsViewController *f = [[FriendsViewController alloc] initWithNibName:@"FriendsViewControlleriPad" bundle:nil];
- [self presentViewController:f animated:YES completion:nil];
- }
- }];
- self.facebookBlock = completionBlock;
- NSString *fields = @"id,name,picture,birthday";
- NSString *format = @"json";
- NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/friends?fields=%@&format=%@&access_token=%@", @"me", fields, format, self.fbAccessTokenData.accessToken];
- NSURL *url = [NSURL URLWithString:urlString];
- NSURLRequest *request = [NSURLRequest requestWithURL:url];
- NSURLResponse *response = nil;
- NSError *error = nil;
- NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
- id result = nil;
- if (data)
- {
- result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
- }
- self.facebookBlock([result valueForKey:@"data"], error);
Add Comment
Please, Sign In to add comment