下面的代码尝试在单击 fbloginview 时允许用户的读取权限后重新授权发布权限。
#pragma mark FBLoginViewDelegate Method
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
NSLog(@"User info fetched %@ %@", user.name, user.id);
[Global FBUser:user.first_name lastname:user.last_name fid:user.id];
if ([[FBSession activeSession] isOpen])
{
//[[FBSession activeSession] closeAndClearTokenInformation];
[[FBSession activeSession] reauthorizeWithPublishPermissions:[[[NSArray alloc] initWithObjects:@"publish_stream", nil] autorelease]
defaultAudience:FBSessionDefaultAudienceEveryone
completionHandler:^(FBSession* session, NSError* error)
{
if ([delegate respondsToSelector:@selector(SignUpAlertViewWasDone:)])
[delegate SignUpAlertViewWasDone:self];
[self removeFromSuperview];
}
];
}
它在这里给了我这个错误:
异常'com.facebook.sdk:InvalidOperationException',原因:'FBSession:重新授权无效,而先前的重新授权调用尚未完成。'
是否有可以检测到上一次重新授权调用何时完成的功能?
我尝试使用 openWithPublishPermission 但它不起作用。