Parse.com and Facebook login, runs infinite loop

2019-05-26 05:35发布

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?

2条回答
闹够了就滚
2楼-- · 2019-05-26 06:01

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.

查看更多
仙女界的扛把子
3楼-- · 2019-05-26 06:12

Sandbox off, then it should works.

查看更多
登录 后发表回答