I am working on an Iphone application and I am using facebook sdk to post on a user’s wall.
I need to create a post with a text and a picture.
For that first I am uploading the picture to the user’s profile by using this:
//image to post is the UIImage I am uploading
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[self imageToPost], @"picture"
[FBRequestConnection startWithGraphPath:@"me/photos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}
This is working corretly. The result I get is in the following format:
{
id = 101586254325716;
"post_id" = "100004123442691_101551541234190";
}
Now I want to post a feed on the user wall containing a text and the image uploaded.
//self.facebookStatus is the text I want to post
//imageURL is the url of the image
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.facebookStatus, @"message",
imageURL, @"picture",
nil];
[FBRequestConnection startWithGraphPath:@"me/feed" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}
Problem:
I dont know what the imageURL should be. I tried to use the id or post_id I get as a result but it is not working. I alst tried www.facebook.com/101586254325716 but didn’t work either.
How can I get the url of the image I uploaded in order to add it to the wall post?
Thanks
PS: If someone has other ways or hints on posting on a users wall, text + image from the iphone That would be great.
It turns out that I have to use the
object_attachmentparameter and set it to the photo idand not the
pictureparameter.Will leave it here in case someone had the same problem