开发者

FBDialog cancel button callback

When user hits the Cancel button in the FBStreamDialog, which inherits from FBDialog, I am having trouble differentiating it from when user clicks on the Publish button. Seems that the callback FBDialog dismissWithSuccess is always passed with the status:NO regardless of which button is clicked. What am I doing wrong? Thanks!

Here's the class that handles all the FBConnect in my app:

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

Here's how I instantiated the login.

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

Here's how I instantiated the 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\":\开发者_如何学C"http://XYZ.com/\"}}}", self.curReview.businessName, self.curReview.reviewType, self.curReview.reviewDetail]; 
[dialog show];


Add the following as the first line in FBDialog.m / webViewDidFinishLoad :

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

Bear in mind that Facebook doesn't let you "punish" users for canceling :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜