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...