我过去曾使用过addThis和share kit,但厌倦了遇到问题。我终于通过Facebook sdk的东西,让它工作。我正在使用它发布到用户的墙上......
-(IBAction)fbPost:(id)sender
{
if (![facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_likes",
@"read_stream",
@"publish_stream",
nil];
[facebook authorize:permissions];
}
SBJSON *jsonWriter = [SBJSON new];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"Name", @"name",
@"Test Caption", @"caption",
@"This sure is fun", @"description",
@"http://www.test.com/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@“xxxxxxxxxx",@"app_id",
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
@"Here is the message",@"message",
nil];
AppDelegate *aDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[aDelegate.facebook dialog:@"stream.publish" andParams:params andDelegate:self];
}
我的问题是......我有办法告诉用户张贴在墙上吗?比方说,我想发布一条消息“谢谢你在脸书上分享”等等。
答案 0 :(得分:2)
我不是ios开发人员,但是从FBDialogDelegate documentation开始,您可以知道用户何时使用dialogDidComplete
方法发布:
在对话框成功后即将调用此方法 隐。您可以使用此方法来处理该成功路径 对话流程。
您可能还想检查其他方法,以了解用户是否已取消或出现错误。
看起来您正在为对话框传递self
,只需在那里实现这些方法。