iphone facebookpublishToStream问题

发布于 2024-10-21 06:58:17 字数 1774 浏览 2 评论 0原文

我正在使用 iOS facebook DemoApp 示例发布到我的个人资料。它工作得很好。我的问题是如何在这篇文章中添加图片链接?我使用的代码是:

- (IBAction)publishStream:(id)sender 
{   
    SBJSON *jsonWriter = [[SBJSON new] autorelease];

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                        @"title",@"text",
                                                        @"http://www.link.com/",@"href",
                                                        nil], nil];

    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"This is a name!", @"name",
                                @"This is a caption!", @"caption",
                                @"http://www.link.com/images/log1.png", @"picture",
                                @"This is a long description that goes on an on.", @"description",
                                @"http://www.link.com", @"href",                                
                                nil];

    NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   kAppId, @"api_key",
                                   @"Share on Facebook",  @"user_message_prompt",
                                   actionLinksStr, @"action_links",
                                   attachmentStr, @"attachment",
                                   nil];    

    [facebook dialog:@"stream.publish"
            andParams:params
          andDelegate:self];
}

图片不会出现。我使用的链接是正确的。并且帖子成功。我如何才能显示该图片链接?

感谢您的任何和所有帮助。

I'm using the iOS facebook DemoApp example to post to my profile. It works just fine. My question is how do I add a picture link to this post? The code I'm using is:

- (IBAction)publishStream:(id)sender 
{   
    SBJSON *jsonWriter = [[SBJSON new] autorelease];

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                        @"title",@"text",
                                                        @"http://www.link.com/",@"href",
                                                        nil], nil];

    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"This is a name!", @"name",
                                @"This is a caption!", @"caption",
                                @"http://www.link.com/images/log1.png", @"picture",
                                @"This is a long description that goes on an on.", @"description",
                                @"http://www.link.com", @"href",                                
                                nil];

    NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   kAppId, @"api_key",
                                   @"Share on Facebook",  @"user_message_prompt",
                                   actionLinksStr, @"action_links",
                                   attachmentStr, @"attachment",
                                   nil];    

    [facebook dialog:@"stream.publish"
            andParams:params
          andDelegate:self];
}

The picture will not come up. The link I use is correct. And the post succeeds. How do I get that picture link to show up?

Thanks for any and all help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燕归巢 2024-10-28 06:58:17

Facebook iOS SDK 中的示例应用程序有点过时。我在对此问题的回答中详细介绍了发布到用户流的正确方法以及相关文档页面 这样的问题

The sample app in the Facebook iOS SDK is a little outdated. I detailed the proper way to publish to a user's stream and the relevant documentation page in my answer to this SO question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文