我正在尝试使用新的Facebook iOS SDK登录后,在Facebook上发布用户墙的链接。
我希望该链接的行为就像用户从其帐户中发布一样。例如,如果我在Facebook墙上发布此链接:http://www.apple.com/,我将看不到该链接。我将看到的是一个图像,一个带有实际网址的标题和一个简短的描述。但是当我从我的应用程序发布这个相同的链接时,我看到的只是链接本身。
如何通过我的应用程序发布此网址,以便最终显示在用户墙上的是格式化的消息,如果他将其从PC上的帐户发布,而不仅仅是链接本身一个字符串?
谢谢,
答案 0 :(得分:28)
编辑:以下代码适用于FB SDK的旧版本
点击此处查看可能有用的最新答案Facebook sdk post on wall on iPhone app
旧帖子:
来自http://developers.facebook.com/docs/reference/dialogs/feed/
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"app_id",
@"http://developers.facebook.com/docs/reference/dialogs/", @"link",
@"http://fbrell.com/f8.jpg", @"picture",
@"Facebook Dialogs", @"name",
@"Reference Documentation", @"caption",
@"Dialogs provide a simple, consistent interface for apps to interact with users.", @"description",
@"Facebook Dialogs are so easy!", @"message",
nil];
[_facebook dialog:@"feed" andParams:params andDelegate:self];
答案 1 :(得分:0)
您需要使用FBStreamDialog。我没有确切的代码。试试这个:
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.userMessagePrompt = @"What's in your mind?";
dialog.attachment = @"{\"name\":\"Apple URL","
"\"href\":\"http://www.apple.com\","
"\"caption\":\"App Name\",\"description\":\"Posting link Test\","
"\"media\":[{\"type\":\"image\","
"\"src\":\"http://www.apple.com\","
"\"href\":\"http://www.apple.com\"}],"
"\"properties\":{\"another link\":{\"text\":\"Apple home page\",\"href\":\"http://www.apple.com\"}}}";
[dialog show];