Posting attachments with Facebook Graph API using iPhone SDK

≡放荡痞女 提交于 2019-11-30 16:30:42

OK, I found how to send properties together with my stream post. I discovered it by taking a look at the html in the actual Facebook Wall page. Turns out, the parameters for the POST object are considered the attachment so the only thing to be done is add the "properties" property directly to the POST parameters like this:

NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"property 1", @"PROP1",
                            @"property 2", @"PROP2",
                            nil];

NSString *propStr = [jsonWriter stringWithObject:properties];


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",
                           propStr, @"properties",
                           nil];

[_facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

And voila! It worked!

To Publish FEED you have to use "USERID/feed"

Eg: [facebook requestWithGraphPath:@"1231241/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];

and regarding the Properties, i dont think their is any properties with name "properties" is available for feed APIs.

Check out here: http://developers.facebook.com/docs/reference/api/photo/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!