5
我剛剛開始使用SDK iOS 3.1開發新應用程序,我注意到現在讀寫權限是分開的。使用ios SDK 3.1發佈到牆上的簡單方法
我正在尋找一種簡單的方法來發布到用戶牆上,但我是個與授權機制
有點困惑。如果我能在openActiveSessionWithReadPermissions的CompletionHandler寫權限,我收到以下錯誤
*** Terminating app due to uncaught exception 'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: It is not valid to reauthorize while a previous reauthorize call has not yet completed.'
completionHandler聽起來像行動已完成,所以我不明白這個代碼有什麼問題。
有什麼建議嗎?
-(void)askWritePerms
{
NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil];
[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
}];
}
- (IBAction)publishFB:(id)sender
{
NSArray *permissions = [NSArray arrayWithObjects:@"email", nil];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
[self askWritePerms];
}
你檢查什麼是會話的狀態?你能記錄狀態的值嗎? –