我一直在拼命地使用Facebook的Graph API發佈附件到當前用戶的牆上的消息。我已經成功地發佈了一個帶有圖片的POST對象,但是一旦我開始閱讀附件,它就無法工作。就好像它不承認那個財產。使用iPhone SDK發佈帶有Facebook Graph API的附件
這裏是我的代碼示例:
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"ATT NAME", @"name",
@"http://my.web.com", @"href",
@"ATT CAPTION", @"caption",
@"ATT DESC", @"description",
[NSDictionary dictionaryWithObjectsAndKeys:
@"property 1", @"PROP1",
@"property 2", @"PROP2",
nil], @"properties"
nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"post", @"type",
@"MY MESSAGE", @"message",
attachmentStr, @"attachment",
nil];
[_facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];
這將出版「我的信息」,但沒有別的。我真正需要這種附件的原因是因爲「屬性」元素。
非常感謝!
編輯:我只是想澄清,如果我使用下面的字典爲我的PARAMS而不是上面的一個,它工作得很好。我的問題是,我需要使用「附件」對象的「屬性」屬性進行格式化。這裏是字典:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"post", @"type",
@"http://my.web.com/pic.png", @"picture",
@"http://my.web.com", @"link",
postName, @"name",
postCaption, @"caption",
postDescription, @"description",
postMessage, @"message",
nil];
嗨艾比,首先感謝您的回覆。我實際上已經能夠使用「我」發佈。我甚至用這裏描述的基本參數發佈了圖像:http://developers.facebook.com/docs/reference/api/post/這個頁面引用了我猜測的「可選附件」是這裏描述的對象:http ://developers.facebook.com/docs/guides/attachments/在這種情況下,他們確實有一個名爲「properties」的屬性。 – sunshineDev 2011-04-06 19:15:17
我不知道這是否可能爲移動設備。因爲這是一個流式附件,通常支持這些網站。如果我沒有錯,您正在使用FBConnect SDK開發iPhone。 – insomiac 2011-04-06 19:26:02
那麼你想上傳或附加?什麼樣的媒體?音樂,閃光燈還是電影? – insomiac 2011-04-06 19:26:28