开发者

Publishing links to user's wall using Facebook iOS SDK

开发者 https://www.devze.com 2023-01-30 00:37 出处:网络
I\'m trying to publish a link to the user\'s wall on Facebook after he has already logge开发者_如何学God in using the new Facebook iOS SDK.

I'm trying to publish a link to the user's wall on Facebook after he has already logge开发者_如何学God in using the new Facebook iOS SDK.

I want the link to behave as if the user posted it from his account. For example, if I post this link on my Facebook wall: http://www.apple.com/, I won't see the link. What I'll see is an image, a caption with the actual url and a short description. But when I publish this same link from my app, all I see is the link itself.

How can I publish this url through my app so that what will eventually appear on the user's wall is the formatted message as it would appear if he would have posted it from his account on the pc, and not just the link itself as a string?

Thanks,


EDIT: The code below is for an OLD version of the FB SDK

Check here for a more up to date answer that may help Facebook sdk post on wall on iPhone app

OLD POST:

From 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];


You need to use FBStreamDialog for this. I do not have the exact code. Try this:

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消