Skip to content

Instantly share code, notes, and snippets.

@seviu
Created January 18, 2016 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seviu/be2ba68febf0facdf816 to your computer and use it in GitHub Desktop.
Save seviu/be2ba68febf0facdf816 to your computer and use it in GitHub Desktop.
// I do not know if this still works, but I used to use this to get friends and their photos in one of iPhonso past apps
- (void)getMyFriends {
[FBSession setSession:self.fbSession];
NSString* fql1 = @"SELECT uid, first_name, last_name, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = %qi) order by first_name";
NSString* fql2 = @"SELECT owner, size FROM album WHERE owner IN (SELECT uid FROM #friend)";
NSString *fql1WithId = [NSString stringWithFormat:fql1, _uid];
NSString *fqlWithId = [NSString stringWithFormat:@"{\"friend\":\"%@\",\"album\":\"%@\",}", fql1WithId, fql2];
NSDictionary* params = [NSDictionary dictionaryWithObject:fqlWithId forKey:@"queries"];
[self.fbconnection cancel];
self.fbconnection = nil;
self.fbconnection = [FBRequest requestWithDelegate:self];
[self.fbconnection call:@"facebook.fql.multiquery" params:params];
}
- (void)getOwnPhotos {
[FBSession setSession:self.fbSession];
//We get them all...
NSString* fql = @"SELECT pid, src_big, caption, created FROM photo WHERE aid IN ( SELECT aid FROM album WHERE owner=%qi ) ";
NSString *fqlWithId = [NSString stringWithFormat:fql, _uid];
NSDictionary* params = [NSDictionary dictionaryWithObject:fqlWithId forKey:@"query"];
[self.fbconnection cancel];
self.fbconnection = nil;
self.fbconnection = [FBRequest requestWithDelegate:self];
[self.fbconnection call:@"facebook.fql.query" params:params];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment