如何使用 iPhone 版 Facebook Graph API 向朋友墙发帖
我想在用户朋友墙上发布一些内容。
我用它来发布到用户墙,
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"a long run", @"name",
@"The Facebook Running app", @"caption",
@"it is fun", @"description",
@"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",nil];
[facebook dialog:@"feed"
andParams:params
andDelegate:self];
但我需要发布到我的朋友墙。我该如何做到这一点
在此帖子他们提到了 targetId 我是否必须对此做些什么。
I want to post something in the users friends wall.
I use this to post into the user wall
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"a long run", @"name",
@"The Facebook Running app", @"caption",
@"it is fun", @"description",
@"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",nil];
[facebook dialog:@"feed"
andParams:params
andDelegate:self];
But i need to post in my friends wall. how can i do this
In this post they have mentioned about targetId do i have to do something with that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否尝试过使用,
更新:
在朋友墙上发帖将不再适用于 Graph API。相反,您必须使用 FBDialog。
Have you tried using,
UPDATE:
Posting on friends wall will no more work with Graph API. Instead you must use FBDialog.
@mAc
你必须先授权facebook。然后,您在类中实现“FBRequestDelegate”方法。然后使用图形 API 发出请求,如下所示
一旦请求成功,API 将调用委托方法“requestDdidLoad”,
从结果中您将获得 Frieds 页面 ID
@mAc
You have to authorize facebook first. Then you implement 'FBRequestDelegate' methods to your class. Then make a request with graph API as given below
Once your request succeeded, api will call the delegate method 'requestDdidLoad',
Form the result you will get the frieds page ID