2

Using Parse SDK 1.9.1 and Facebook 4.8.0 I receive no callbacks and my completion blocks never get executed. I have all necessary things in my AppDelegate and everything went well until I upgraded my sdks.

examples in my code:

if (![PFUser currentUser]) {
    NSLog(@"!PFUser current user");
    NSArray *permissions = @[@"public_profile", @"email", @"user_friends"];

    [PFFacebookUtils logInInBackgroundWithReadPermissions:permissions block:^(PFUser *user, NSError *error) {
        NSLog(@"User:%@",[user description]);
        if (!user) {

            NSLog(@"Uh oh. The user cancelled the Facebook login.");
            NSLog(@"Uinfo :%@",[error userInfo][@"error"]);
        } else if (user.isNew) {
            NSLog(@"User signed up and logged in through Facebook!");
            [self updateUiForLoggedInUser];
            [self updateInstallationChannels];

        } else {
            NSLog(@"User logged in through Facebook!");
            [self updateUiForLoggedInUser];
            [self updateInstallationChannels];
        }
        if (error) {
            NSLog(@"Error trying to login:%@",[error description]);
        }
    }];
}

And also:

 if (![PFFacebookUtils isLinkedWithUser:[PFUser currentUser]]) {
    [PFFacebookUtils linkUserInBackground:[PFUser currentUser] withReadPermissions:nil block:^(BOOL succeeded, NSError *error) {
        if (succeeded) {
            NSLog(@"Woohoo, user is linked with Facebook!");
        }
    }];
}

Any idea why? Thanks in advance!

EDIT: I tried moving PFFacebookUtils logInInBackgroundWithReadPermissions: to another viewcontroller and it works fine. Any idea why it wont work on MainViewController?

rici
  • 234,347
  • 28
  • 237
  • 341
RawKnee
  • 324
  • 3
  • 11

1 Answers1

0

I figured it out. Dunno why it happend but it seems that requests to FBFacebookUtils are now not asynchronous... I called linkUserInBackground right after loginInBackground and the response I got is only for linkUserInBackground. After separating those two methods everything works well.

RawKnee
  • 324
  • 3
  • 11
  • Hi. I am having the same problem as you did. The 'logInInBackgroundWithReadPermissions' block is never executed in the Main view controller. However it works fine in other view controllers. Also I noticed that it works fine (block executed in Main view controller) when I run it on a device. I just doesn't work on a simulator. – Vijay Apr 25 '16 at 01:42
  • Check that there are no requests before and after this specific requests. if there is and you remove them, and everything works, then you might needs to make your calls concurrenct – RawKnee Apr 30 '16 at 15:45