Parse.com and Facebook login, runs infinite loop

2019-05-26 06:15发布

问题:

I updated both Parse and Facebook iOS SDKs to the latest versions, and when I try to login using Facebook my app crashes, and from the debugger I can see that it is calling 3-4 methods in an endless loop.

My login code looks like this:

- (void)openSession
{
    UIViewController *topViewController = self.window.rootViewController;
    NSArray *permissions = [NSArray arrayWithObjects:@"user_likes", @"friends_likes", nil];

    // Login PFUser using Facebook
    [PFFacebookUtils logInWithPermissions:permissions block:^(PFUser *user, NSError *error) {
        if (!user) {
            if (!error) {
                NSLog(@"Uh oh. The user cancelled the Facebook login.");
            } else {
                NSLog(@"Uh oh. An error occurred: %@", error);
            }
        } else if (user.isNew) {
            NSLog(@"User with facebook signed up and logged in!");

            if ([[topViewController presentedViewController] isKindOfClass:[PALoginViewController class]]) {
                [topViewController dismissViewControllerAnimated:YES completion:nil];
            }
        } else {
            NSLog(@"User with facebook logged in!");
            if ([[topViewController presentedViewController] isKindOfClass:[PALoginViewController class]]) {
                [topViewController dismissViewControllerAnimated:YES completion:nil];
            }
        }
    }];
}

The error occurs when logInWithPermissions is called. It crashes into Xcode and Debugger is showing an awful lot of calls to FB login methods - thousands actually:

Stack trace http://f.cl.ly/items/3z270O3L1s173Z3o0V3E/Screen%20Shot%202013-04-20%20at%2010.25.51%20AM.png

What could be wrong?

回答1:

This issue was reported as a bug on Facebook: https://developers.facebook.com/bugs/188127071335876?browse=search_5176d24c698df3761093726

It has now been fixed, and I can confirm that logging in now works - even with Sandbox enabled.



回答2:

Sandbox off, then it should works.