Anton Gildebrand
Anton Gildebrand

Reputation: 3707

Facebook Graph post image to page

I can succesfuly upload pictures to my own wall by posting an image to https://graph.facebook.com/me/photos. Now i need to post to a page's wall instead. I have the page ID, but when i change "me" in the url to the pages ID, the image is still posted to my own wall instead of the page's. How do i post an image to a page's stream?

And which permissions is required to do so?

It would be great if you guys could help me out, has got stuck on this one. Thank you!

Upvotes: 2

Views: 2228

Answers (2)

Venu Gopal Tewari
Venu Gopal Tewari

Reputation: 5876

m_imgData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"Default.png"]];

NSMutableDictionary *fbArguments = [[[NSMutableDictionary alloc] init] autorelease];

[fbArguments setObject:self.m_imgData forKey:@"source"];
[fbArguments setObject:@"Uploading images" forKey:@"message"];


[m_facebook requestWithGraphPath:@"Page_ID/photos"
                       andParams:fbArguments
                   andHttpMethod:@"POST"
                     andDelegate:self];

Where i am using Default.png as a image to upload. m_facebook is allocated object of Class Facebook (Provided as a part of Facebook SDK). m_imageData is an object of NSData.

Upvotes: 0

Juicy Scripter
Juicy Scripter

Reputation: 25918

You cannot upload pictures to wall (it's uploading to album).

To upload picture to Page's Album you need to use page access_token that is accessible via accounts connection of user (you'll need manage_pages permission to get this info).

Once you have access_token for page you may upload picture in the same way as you do for user but using page id instead of user id (you will need publish_stream permission for user to post content pages he own).

Upvotes: 3

Related Questions