简体   繁体   中英

iOS facebook graph request completion handler block not called

I'm using Facebook iOS SDK and Parse to handle user login through Facebook on one of my apps. However, after building app with iOS 9 SDK, the app seems failed to fetch information from Facebook's graph API.

Here is the code snippets I used to pull information from Facebook

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]initWithGraphPath:@"me" parameters:@{@"fields":@"name,email,id,gender"} HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error){
        NSLog(@"%@",result);
}];

After setting a breakpoint, I found the completionHandler block was not called at all, meaning there is no results nor error from the call...

I have changed the info.plist file based on instructions for iOS 9 on Facebook website . And the app is using Facebook login and it worked completed fine for logging in.

When the user logging in, the permission I used for the app is @[@"public_profile",@"email",@"user_friends"] .

Any suggestions is greatly appreciated!

It might should be a complete code like below this

FBRequest *meRequest=[[FBRequest alloc]initWithSession:self.session graphPath:[NSString stringWithFormat:@"me"]parameters:@{@"fields":@"name,email"} HTTPMethod:@"GET"];
[meRequest startWithCompletionHandler:
 ^(FBRequestConnection *connection,
   NSDictionary* result,
   NSError *error)
 {
     fbCompletion(result,error);
 }];

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