簡體   English   中英

iPhone Facebook API將照片附加到牆上

[英]Iphone Facebook API attach photo to post wall

我在使用此代碼以便在使用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];

一切正常,但照片未顯示在帖子中。

任何想法?

謝謝

根據docs ,流附件中似乎沒有“圖片”字段。 似乎應該使用“媒體”字段代替“圖片”字段,例如

"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/"
    }
]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM