Search code examples
facebooktagsfacebook-graph-apiphotos

Tagging Photos via Facebook GraphAPI


Facebook recently added photo-tagging capabilities to its Graph API: http://developers.facebook.com/blog/post/509/

I am using FbConnect on iPhone to upload a picture and tag my page inside it. So, my first call is:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   self.imageToPost, @"picture",
                                   @"My caption!", @"name", @"tags",
                                   nil];

    [self.theFacebook requestWithGraphPath:@"me/photos"
                                 andParams:params
                             andHttpMethod:@"POST"
                               andDelegate:self];

This correctly returns: { id = 2092859844825; }

Then I make another call:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   FACEBOOK_PAGE_ID,@"to", 
                                   @"160",@"x", 
                                   @"240",@"y", 
                                   nil];

    [self.theFacebook requestWithGraphPath:[NSString stringWithFormat:@"%@/tags",photoId]
                                 andParams:params
                             andHttpMethod:@"POST"
                               andDelegate:self];

Then I get: {contents = "OAuthException"} {contents = "(#121) Invalid photo id"}

But what ID does it expect from me? Submitting the same request in GET method, it doesn't give the error, so I think the id is correct. Any ideas??


Solution

  • What permissions do you have set? Check you have the user_photos permission