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:
What could be wrong?
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.
Sandbox off, then it should works.