Reputation: 41
For an iOS app, using facebook sdk i need to fetch photos from user's album but i need to fetch them in a single request so that i could get info about albums and containing photos at the same time, for that i tried
/me/albums?fields=count,name,photos.limit(10){images}
that api call is working fine in Graph api explorer but not on iOS platform. I only need images field of photos that is why using above api call
If i run this api it runs fine
/me/albums?fields=count,name,photos.limit(10)
only {images} part is causing the problem, the error message which i get is of unsupported url, have acquired the permissions for user_photos
Code :
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/albums?fields=count,name,photos.limit(10){images}" parameters:nil HTTPMethod:@"GET"];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if(!error) {
NSLog(@"result %@",result);
} else {
NSLog(@"error description : %@",error.description);
}
}];
[connection start];
Upvotes: 1
Views: 931
Reputation: 41
I was making the final url call by adding/removing fields from graph api explorer side pane, the request call it was generating was
/me/albums?fields=count,name,photos.limit(10){images}
not working on iOS platform, but if i use this syntax instead
/me/albums?fields=count,name,photos.limit(10).fields(images)
to address fields of photos then it works fine, got the inspiration from answer posted here
Upvotes: 3