This is my code to get the whole dictionary representing the user Graph:
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
NSLog(@"%@",user);//Displayed with the gender
NSLog(@"%@",user.name);//Name only displayed
NSLog(@"%@",user.gender);//Build error
}
}];
}
I would love to know what's wrong with the gender data, and why it's not found in the dictionary, actually, i get a build error:
property 'gender' not found on object of type 'NSDictionary<FBGraphUser> *'
Facebook is not sending gender in response of "requestForMe". In order to get gender send request like this:
NSDictionary* params = [NSDictionary dictionaryWithObject:@"id,gender,name, whatever you like" forKey:@"fields"];
[[FBRequest requestWithGraphPath:[NSString stringWithFormat:"%d",myUserId] parameters:params HTTPMethod:nil] startWithCompletionHandler:...
I am not sure but I think you can also as graph path set @"me" instead of user's id.