我过去曾使用过 addThis 和共享工具包,但厌倦了遇到问题。我终于浏览了 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];
}
我的问题是......我有办法告诉用户张贴到他们的墙上吗?例如,我想发布一条消息“感谢您在 Facebook 上分享”或其他内容。