I need to show the other participant's name and image in a TableView
just like Facebook Inbox.
I am using this fql query to get the recipients.
- (void)readInbox {
NSString *query =
[NSString stringWithFormat:@"SELECT recipients,thread_id FROM unified_message where thread_id IN (SELECT thread_id FROM unified_thread WHERE folder = 'inbox')"];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
query, @"q",
nil];
FBRequest *request = [FBRequest requestWithGraphPath:@"/fql"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSLog(@"Result: %@", result);
}];
}
and the result is something like this
data = ({
recipients = ({
email = "****@facebook.com";
name = "*****";
"user_id" = 6 * * * ;
}, {
email = "****@facebook.com";
name = "******"; //This is me
"user_id" = * * * ;
});
"thread_id" = "t_mid.1371470061934:11b440f1722f8fc977";
},
Is this correct for what i want to show?
How do I get all the other participants (other than me) using fql?
You will receive JSON
data using FQL query. Parse it and store it in Mutable Array
.
You can use the following query to obtain name
and id
of a user from his mailbox.
SELECT name, uid FROM user WHERE uid IN (SELECT author_id FROM message WHERE thread_id IN (SELECT thread_id FROM thread WHERE folder_id = 0))
Now the first index would be you. Remove it from the array if you want.