开发者

Iphone Facebook API attach photo to post wall

i having problems using this code in order to include a photo in my post using the Facebook API:

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       @"FSM",@"text",@"www.me.com",@"href", nil], nil];

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];


NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"I'm going to:", @"name",
                            @"IMG URL", @"picture", 
                            self.reservation.evento.name, @"caption",
                            self.reservation.evento.date, @"description",
                            @"www.me.com", @"href",
                            nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               kAppId, @"api_key",
                               @"Compartir en FB",  @"user_message_prompt",
                               actionLinksStr, @"action_links",
                               attachmentStr, @"attachment",
                               nil];

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

Everything works fine except that the photo isn't sho开发者_运维知识库wn in the post.

Any idea?

Thanks


There doesn't seem to be a "picture" field in stream attachments according to the docs. Instead of a "picture" field, it seems you should have a "media" field such as

"media" : [
    { 
        "type": "image", 
        "src": "http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-kitten-finished-his-milk-and-wants-a-cookie.jpg", 
        "href": "http://icanhascheezburger.com/2009/03/30/funny-pictures-awlll-gone-cookie-now/"
    }
]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜