我在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;
}
}];
}
有谁知道我做错了什么?