Reputation: 910
I'm trying to post a Facebook status update, using the Facebook iOS API, with a message and a link to a photo that is already on Facebook. I have already obtained the URL of the image using the result of an another graph API call. I have already set the App to have permissions for read_stream, publish_stream, offline_access and user_photos.
When I post the image as part of a status update, I receive the error "The operation couldn't be completed. (facebookErrDomain error 10000.)". However, if I attempt to post an image not already on Facebook, the status update posts fine and the image is shown.
This is strange as if I attempt to do the same in Facebook on the web by posting to my wall, I can include a link to the image that is in Facebook, which works fine.
Is there something I'm doing wrong attempting to include an image already in Facebook? The call I'm using is:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"CIAO",@"message",
@"http://photos-g.ak.fbcdn.net/hphotos-ak-snc6/<rest_of_the_image_url>.jpg", @"picture",
nil];
[_facebook requestWithGraphPath:@"me/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
what am I doing wrong?
Thanks!
Upvotes: 1
Views: 2995
Reputation: 39376
You can do this by using the "object_attachment" tag instead of "picture". This will allow you to use a picture in your album as the icon of a timeline or wall posting. Just take the id of the uploaded image as returned in - (void)request:(FBRequest *)request didLoad:(id)result
Read more here: Attaching Existing Facebook Photos to Wall Posts
Upvotes: 2
Reputation: 2981
You can no longer post images hosted by Facebook. From the Facebook Developers page on Stream Attachements:
Don't reference images that are hosted on the fbcdn.net domain. The images associated with these URLs aren't always optimized for stream stories and occasionally resulted in errors, leading to a poor user experience. Make sure your stream attachments don't reference images with this domain. You should host the images locally.
However, the error you should have received is:
{
error: {
type: "OAuthException",
message: "(#100) FBCDN image is not allowed in stream: http://graph.facebook.com/100001717292608/picture",
}
}
Upvotes: 2