Select name, status from user where uid in (select uid2 from friend where uid1 = <SessionUserId>)
After setting up session and logging in ,a request is made using Facebook iOS sdk as:
NSString* fql = [NSString stringWithFormat:@”Select name, status from user where uid in (select uid2 from friend where uid1 = %lld)”, <session User ID>];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@”query”];
[[FBRequest requestWithDelegate:self] call:@”facebook.fql.query” params:params];
But you will find out status and friend names are found to be Null.Because we have haven’t provide any permission yet.
So we have to provide permission after login as:
FBPermissionDialog* friendStatusDialog = [[[FBPermissionDialog alloc] init] autorelease];
friendStatusDialog.permission = @”friends_status”;
[ friendStatusDialog show];
And now on running , friend names are retrieved.But still there is a problem status messages are still Null. Because we haven’t provide the application the key to enter into that room.
Then this will be provided as:
FBPermissionDialog* statusUpdateDialog = [[[FBPermissionDialog alloc] init] autorelease];
statusUpdateDialog.permission = @”status_update”;
[ statusUpdateDialog show];
Now it is, all friends name and status are retrieved.
Thus, only those rooms will be accessed whose keys we have in our pocket.