Reputation: 509
I am trying to fetch the friends of the user (who is logged in into his FaceBook account) based upon the gender of his friends and based upon the pic_big!=NULL
(Every friend should have a big profile picture).
Below is my code that I am writing.
NSString *queryString = [NSString stringWithFormat:@"%@%@%@%@%@%@%i%@%@",
@"SELECT name, pic_big, sex, uid FROM user ",
@"WHERE sex=", @"male", @" AND ",
@"pic_big != 'null' AND uid IN (SELECT uid2 ",
@"FROM friend WHERE uid ", loggedInID, @" )",
@"ORDER BY name"];
NSMutableDictionary *dictionary=[NSMutableDictionary
dictionaryWithObjectsAndKeys:queryString,@"query", nil];
[FBRequest getRequestWithParams:dictionary
httpMethod:@"GET"
delegate:self
requestURL:@"fql.query"];
loggedINiD
is the user's login ID. I am not getting any response in the delegate methods. I am sure I need to recheck this SQL query. Any suggestions please.
Upvotes: 1
Views: 1347
Reputation: 4439
You have a couple of errors in your FQL code and adding one suggestion I would make for simplicity, here is what you should query instead:
SELECT name, pic_big, sex, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = "male"
Things to note:
Upvotes: 2
Reputation: 1814
NSString *queryString = [NSString stringWithFormat:@"SELECT name, pic_big, sex, uid FROM user WHERE sex='male' AND pic_big != 'null' AND uid IN (SELECT uid2 FROM friend WHERE uid = %i) ORDER BY name", loggedInID];
Use this queryString. I am not sure but think this will help you.
Upvotes: 0