使用 Parse SDK 1.9.1 和 Facebook 4.8.0 我没有收到回调,我的完成块永远不会被执行。我的 AppDelegate 中有所有必要的东西,一切都很顺利,直到我升级了我的 sdks。
我的代码中的示例:
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]);
}
}];
}
并且:
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!");
}
}];
}
知道为什么吗?提前致谢!
编辑:我尝试将 PFFacebookUtils logInInBackgroundWithReadPermissions: 移动到另一个视图控制器,它工作正常。知道为什么它不能在 MainViewController 上工作吗?