I\'m trying to get information through the facebook sdk but so far I\'m getting only the id and the name of the user, although I\'m sure there is an email available, as it i
this works... hope it helps..
NSMutableDictionary* parameters = [NSMutableDictionary dictionary];
[parameters setValue:@"id, name, email" forKey:@"fields"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:parameters]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
{
NSLog(@"Fetched user is:%@", result);
}];
Facebook Graph API broke it’s backward compatibility (when used in a default fashion) Since Graph-API version 2.4 (Pod Version 4.4.0).
FB Graph-API 2.4 does NOT return all default fields for user
To resolve this you can either use explicitly graph version 2.3:
[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil tokenString:[FBSDKAccessToken currentAccessToken].tokenString version:@"v2.3" HTTPMethod:nil]
in which case FB assures v2.3 will be available at least 2 years from now. https://developers.facebook.com/docs/graph-api/overview:
The Graph API has multiple versions available to access at any one time. Each version contains a set ofcore fields and edge operations. We make a guarantee that those core APIs will be available and un-modified in that version for at least 2 years from release. The platform changelog can tell you which versions are currently available.
OR
you can use new Graph-API (v2.4) in by asking for specific fields you are interested in:
[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields" : @"email,name"}]