I am using Parse included Facebook SDK and i need to show the list of albums for a given user. I can correttly get the list of albums:
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"/%@/albums", self.facebookUserId]
completionHandler:^( FBRequestConnection *connection, id result, NSError *error )
{
// result will contain an array with your user's albums in the "data" key
NSArray * albumsObjects = [result objectForKey:@"data"];
NSMutableArray * albums = [NSMutableArray arrayWithCapacity:albumsObjects.count];
for (NSDictionary * albumObject in albumsObjects)
{
//DO STUFF
}
self.albums = albums;
[self.tableView reloadData];
}];
At this point for each album i need to get it's cover picture.
The album object has both a id
field and an cover_photo
one. i have tried with both as parameter for the graph query same outcome: result
is nil
NSDictionary *params = @{ @"type": @"album"};//, @"access_token": [[PFFacebookUtils session] accessToken]};
[FBRequestConnection startWithGraphPath: [NSString stringWithFormat:@"/%@/picture", album.coverPath]
parameters:params
HTTPMethod:@"GET"
completionHandler:^( FBRequestConnection *connection, id result, NSError *error ) {
NSString * urlString = [result objectForKey:@"url"];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[cell.imageView setImageWithURLRequest:request
placeholderImage:placeholderImage
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
weakCell.imageView.image = image;
[weakCell setNeedsLayout];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"%@",error.debugDescription);
}];
}];
I have in the appdelegate
[PFFacebookUtils initializeFacebook];
and i manage there the session that is working flawlessly in all other palces.
And these are the permissions i require at login
@[@"user_about_me", @"email", @"user_birthday", @"user_location" ,@"user_friends", @"publish_actions", @"user_photos", @"friends_photos"]
Ideas? Also in the documentation https://developers.facebook.com/docs/graph-api/reference/v2.3/album/picture it says to use the album-id, but then what is the cover_photo id for?