我正在尝试向朋友列表中的朋友发布一些数据。 我可以在我朋友的墙上发布一些文字。但是它无法发布图像和其他数据。 (Presentl我只能看到关键字“消息”的文字,其余部分没有出现在帖子中。
SBJSON *jsonWriter = [[SBJSON new] autorelease];
/*
Action LInks
*/
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
//Json Object Conversion
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
/*
Media Data in this case an image.
*/
**NSMutableDictionary *dictMedia=[NSMutableDictionary dictionaryWithObjectsAndKeys:@"image",@"type",@"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg",@"src",@"www.fizzysoftware.com",@"href", nil];
NSArray *mediaArray=[[NSArray alloc] initWithObjects:dictMedia, nil];
NSString *mediaJsonString=[jsonWriter stringWithObject:mediaArray]; // error:actionLinksStr]
//Attatchment Data :Include media data,action link etc.
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"First Title", @"name",
@"This is the subtitle", @"caption",
@"This is is description", @"description",
mediaJsonString, @"media", nil];
//Json conversion of the attachment data.
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];**
//Main parameter
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"message",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
//Post to friend's wall, whose uid is friend_uid
[ _facebook requestWithGraphPath:[NSString stringWithFormat:@"friend_uid/feed/"] andParams:params
andHttpMethod:@"POST" andDelegate:self];
我在发送附件时误以为的任何建议。我只能在帖子中看到 param 的“消息”部分,并且帖子中没有显示任何附件数据。 提前谢谢。
答案 0 :(得分:0)
您可以尝试使用新方法打开供稿对话框,并将“to”(以前是目标)参数以及其他附件直接设置为params。
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"some facebook id", @"to",
@"http://yourpage.com", @"link",
@"http://yourpage.com/image.png", @"picture",
@"the name", @"name",
@"the caption", @"caption",
@"the description", @"description",
nil];
[_facebook dialog: @"feed" andParams: params andDelegate: self];
这里有一些关于Feed对话框的文档。
http://developers.facebook.com/docs/reference/dialogs/feed/
如果你直接发帖,你应该做这样的事情:
[_facebook requestWithGraphPath:@"some facebook id/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
关于直接职位的文件: http://developers.facebook.com/docs/reference/api/user/#posts
希望这有帮助。