3

我指的是Facebook上的「ios 3.5如何」。這裏是我的代碼成功FB ShareDialog後如何獲得帖子ID

[FBDialogs presentShareDialogWithParams:params 
         clientState:nil 
          handler: 
^(FBAppCall *call, NSDictionary *results, NSError *error) { 
if(error) { 
    // If there's an error show the relevant message 
    [self showAlert:[self checkErrorMessage:error]]; 
} else { 
    // Check if cancel info is returned and log the event 
    if (results[@"completionGesture"] && 
     [results[@"completionGesture"] isEqualToString:@"cancel"]) { 
     NSLog(@"User canceled story publishing."); 
    } else { 
     // If the post went through show a success message 
     [self showAlert:[self checkPostId:results]]; 
    } 
} 

結果我只得到值爲1的didComplete鍵。我怎樣才能得到post_id?

回答

2

使用字典

call.dialogData.clientState 
0

你已經檢查了結果NSDictionary

NSLog(@"Results Dictionary: %@",results);放入您的第二個else語句中並檢查此字典的內容。

+0

我已經我只得到didComplete在字典:( – a4arpan

0

你只得到POST_ID如果用戶登錄到Facebook上你的應用程序返回。也就是說,如果用戶已經認證了你的應用程序。如果用戶未對您的應用程序進行身份驗證,則不會返回。

因此,請嘗試放一個FBLoginView,登錄並查看是否返回post_id。

+0

它不是!沒有post_id與登錄,以及很好的嘗試。 – mentat

0

我注意到它只能在ios5上完成,如果你在ios6上測試它,那麼可以同時獲得「didComplete」和「completionGesture」。這可能是Facebook SDK的一個bug。