开发者

iphone facebook publishToStream question

开发者 https://www.devze.com 2023-02-15 05:01 出处:网络
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:

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.


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.

0

精彩评论

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

关注公众号