简体   繁体   中英

Facebook Graph Api call not working for iOS

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];

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM