Reputation: 49077
I want to get all photos from the different albums of a user. So I write a request me/albums
then in didLoad
I get an array of albums, which I can use the id of each album to issue a new request albumId/photos
but how should I do that? Should I add the request in the didLoad
, but then, how would I know them apart?
Upvotes: 2
Views: 416
Reputation: 138
you could also keep the refs to the FBRequest
instance returned by each requestWithGraphPath
call and match them with the ref. you get when the delegate methods are called back.
Upvotes: 3
Reputation: 1395
Ok this is how I do it might not be the best way to go about it but it works. In the did load
-(void)request:(FBRequest *)request didLoad:(id)result {
NSString *requestType =[request.url stringByReplacingOccurrencesOfString:@"https://graph.facebook.com/" withString:@""];
NSLog(@"request %@",requestType); }
Now the requestType would be either me/albums or albumId/photos. Put in a couple a conditional if-statements and you are good to go. And yes you can add the new request for fetching photos from the albums in the didLoad in the if condition that matches me/albums (meaning you got some result for that request ie the albums array). The next time you hit the didLoad it would be for the photos in the albums. Hope that helps.
Upvotes: 3