2009-12-06 58 views
1

當用戶點擊從FBDialog繼承的FBStreamDialog中的Cancel按鈕時,我無法區分它與用戶單擊Publish按鈕時的區別。似乎回調FBDialog dismissWithSuccess總是以狀態:NO傳遞,無論點擊哪個按鈕。我究竟做錯了什麼?謝謝!FBDialog取消按鈕回調

下面是處理所有FBConnect在我的應用程序類:

@interface SocialMediaViewController : UIViewController <FBSessionDelegate, FBRequestDelegate, FBDialogDelegate> {... 

這是我如何實例登錄。

FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:self.fbSession] autorelease]; 
dialog.delegate = self; 
[dialog show]; 

下面是我如何實例化FBStreamDialog。

FBStreamDialog* dialog = [[FBStreamDialog alloc] init]; 
dialog.delegate = self; 
dialog.userMessagePrompt = @"Enter additional comment:"; 
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"My name string %@\"," "\"href\":\"http://xyz.com/\"," "\"caption\":\"placeholder-%@\",\"description\":\"%@\"," "\"properties\":{\"More like this\":{\"text\":\"XYZ website\",\"href\":\"http://XYZ.com/\"}}}", self.curReview.businessName, self.curReview.reviewType, self.curReview.reviewDetail]; 
[dialog show]; 

回答

5

添加以下爲FBDialog.m第一線/ webViewDidFinishLoad:

[_webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('cancel').onclick = function onclick(event) { window.location.href = 'fbconnect:cancel'; }"]; 

記住,Facebook並沒有讓你 「懲罰」 用戶取消:-)