Query completion handler block on iOS facebook not called

I use the Facebook iOS SDK and Parse to handle user login via Facebook in one of my applications. However, after creating the application with the iOS 9 SDK, the application did not seem to be able to retrieve information from the Facebook chart APIs.

Here are the code snippets that I used to output 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 the breakpoint, I found that the block completionHandlerwas not called at all, that is, there were no results and errors from the call ...

I changed the file info.plistbased on the instructions for iOS 9 on the Facebook website . And the application uses a Facebook account, and it worked great for logging in.

When a user logs in, the permission that I used for the application is @[@"public_profile",@"email",@"user_friends"].

Any suggestions are welcome!

+4
source share
1 answer

This may be the complete code as shown below.

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);
 }];
0
source

Source: https://habr.com/ru/post/1608410/


All Articles