Jeremy
Jeremy

Reputation: 1521

iOS Facebook SDK Post a picture on a Page where i have admin rights

I'm having a problem while trying to post a picture on a FB Page I'm the admin. The picture is uploaded on my own account instead of my page.

Here's the code i'm using to do this:

- (void)apiGraphUserPhotosPost:(UIImage*)img  withMessage:(NSString*)message { 
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSUInteger c;
    for (c = 0; c < [gFBPageArray count]; c++)
    {
        if ([[[gFBPageArray objectAtIndex:c] objectForKey:@"name"] isEqualToString:[defaults objectForKey:@"FBPostAs"]])
            break;
    }
    params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
              img, @"picture", message, @"message", [[gFBPageArray objectAtIndex:c] objectForKey:@"access_token"], @"access_token",nil];
    [[self facebook] requestWithGraphPath:[NSString stringWithFormat:@"/%@/photos", [[gFBPageArray objectAtIndex:c] objectForKey:@"id"]]
                                       andParams:params
                                   andHttpMethod:@"POST"
                                     andDelegate:self];
}

[defaults objectForKey:@"FBPostAs"] contains the name of the FB page where i want to upload the picture.

gFBPageArray contains the list of FB page where i have admin rights.

Am I doing something wrong?

I've done something similar with the /PageID/feed and /PageID/videos and it works well...

Upvotes: 4

Views: 1737

Answers (1)

Fabio Cardoso
Fabio Cardoso

Reputation: 1269

You can find your answer for this problem here: picture-post-to-facebook-ends-up-in-the-wrong-place

If you want I can put more details here (copy/past) the code.

Upvotes: 3

Related Questions