我在为 IOS6 中的 publish_stream 重新授权用户时遇到问题。当用户第一次将应用程序添加到 Facebook 时,我能够让它工作。如果用户删除了 Facebook 应用程序设置“发布您的行为”的权限,那么我重新运行该应用程序仍然可以访问的 iPad 应用程序,但它不会向用户弹出 publish_stream 权限的对话框。
这是我写的代码:
if ([[FBSession activeSession] isOpen])
{
//if ([[[FBSession activeSession]permissions]indexOfObject:@"publish_stream"] == NSNotFound) {
[[FBSession activeSession] reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:@"publish_stream", nil]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
[self sessionStateChanged:session
state:session.state
error:error
success:success failure:failure];
}];
return false;
//}
//else
// return TRUE;
}
else
{
return [FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObjects:@"user_photos", nil]
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
switch (state)
{
case FBSessionStateCreated:
case FBSessionStateCreatedTokenLoaded:
case FBSessionStateOpen:
[[FBSession activeSession] reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:@"publish_stream", nil]
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
[self sessionStateChanged:session
state:session.state
error:error
success:success
failure:failure];
}];
break;
}
}];
}
有谁知道我做错了什么?