Tuesday, September 28, 2010

Facebook iOS SDK post to wall problem: facebookErrDomain error 10000

I was trying to post an image to a friend's wall using the Facebook iOS SDK and the DemoApp which comes with it.

I added a new button which posts a sample image using the Graph API


NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"api_key", imagePath, @"picture", @"testing", @"message",
nil];
[_facebook requestWithGraphPath:@"USER_ID/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];


but was getting the error:

facebookErrDomain error 10000

The solution was to add publish_stream to the list of permissions passed on to the [facebook authorize] method and finally got it to work.

NOTE: The image I posted to a friend's wall was from a publicly available link and not some binary data I have on the iOS application. For some reasons (and I find this really strange), Facebook does not allow posting an image from their domain to friend's wall using the Graph API.

10 comments:

  1. I'm having a similar problem...What other permissions did you include?

    ReplyDelete
  2. @Scott

    Our iOS application allows the user to post images to his Facebook wall. Currently I only have two permissions set: read_stream and publish_stream.

    Hope this helps!

    ReplyDelete
  3. Jules Robichaud-GagnonNov 25, 2010 12:51 PM

    I have this same error ("facebookErrDomain error 10000") when I post wall messages within less than about 10 minutes interval. I cannot find anything about this 10 minutes delay. Is that normal?

    We want to post achievements on facebook in an iOS game and in some situation they might happen in less than 10 minutes.

    ReplyDelete
  4. Hi Jules,

    Unfortunately, I'm not aware of such interval problems. In my case I'm able to post in intervals of less than a minute.

    Hope this helps!

    ReplyDelete
  5. Jules Robichaud-GagnonNov 26, 2010 06:06 AM

    This really help, thanks.

    It proves there is a problem somewhere. I have yet to find it.

    ReplyDelete
  6. I'm trying to post a message on friend's wall, using requestWithGraphPath and I've requested permissions: @"publish_stream",@"read_stream", @"offline_access" and I'm still getting

    facebookErrDomain error 10000.

    Any ideas? The code for posting is:

    NSString* path = [NSString stringWithFormat:@"%d/feed", friendFbId];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
    kAppId, @"api_key",
    @"Please join me...", @"message",
    @"http://someurlhere", @"link",
    @"http://somepicurlhere.png", @"picture",
    @"Join me in...", @"name",
    msg, @"description",
    nil];
    [facebookHandle requestWithGraphPath:path andParams:params andHttpMethod:@"POST" andDelegate:self];

    ReplyDelete
  7. @Mayoneez

    Can you confirm that the URL that you're using for @"link" param is not from FB's domain? Another problem I had which threw the same error was when using a URL from Facebook (for example uploading an image to FB, getting that image's url and then posting that URL to a friend's wall).

    ReplyDelete
  8. The url in link is not from FB domain. I also tried using just the "message" parameter and left out everything else. Same error.

    ReplyDelete
  9. I tested posting on my own wall (with graph path: "me/feed") and the code works. So it seems to be somehow related to permissions but I don't understand what's the problem, since according to documentation publish_stream permission should give me rights to publish to my and my friends' walls.

    ReplyDelete
  10. My bad. The actual reason was in fact the friend ID I was using. I got the id from facebook and converted it to a number and it was most likely over the int range and flipped to another number. I then stored the number as an NSString and passed that in the POST request and it worked. Stupid of me...

    ReplyDelete