FBDialog取消按钮回调

时间:2009-12-06 16:07:00

标签: iphone fbconnect

当用户点击继承自FBDialog的FBStreamDialog中的“取消”按钮时,我无法区分它与用户点击“发布”按钮时的区别。似乎无论单击哪个按钮,回调FBDialog dismissWithSuccess总是以状态:NO传递。我究竟做错了什么?谢谢!

这是在我的应用程序中处理所有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];

1 个答案:

答案 0 :(得分:5)

将以下内容添加为FBDialog.m / webViewDidFinishLoad中的第一行:

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

请记住,Facebook不会让你“惩罚”用户取消:-)