【问题标题】:iphone facebook publishToStream questioniphone facebook publishToStream 问题
【发布时间】:2011-03-08 00:35:41
【问题描述】:

我正在使用 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];
}

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

感谢所有帮助。

【问题讨论】:

    标签: iphone facebook ios sdk fbconnect


    【解决方案1】:

    Facebook iOS SDK 中的示例应用有点过时了。我在对此SO question 的回答中详细介绍了发布到用户流和相关文档页面的正确方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多