objective c - [Facebook-iOS-SDK 4.0]How to get user email address from FBSDKProfile -
i'm upgrading app facebook-ios-sdk-4.0, seems can't user email fbsdkprofile
, since provide, username, userid, etc.
to fetch email need utilize graph api, providing parameters field populated fields want. take @ facebook's graph api explore tool, can figure out queries. https://developers.facebook.com/tools/explorer
the code worked me fetch email following, assumes logged in:
nsmutabledictionary* parameters = [nsmutabledictionary dictionary]; [parameters setvalue:@"id,name,email" forkey:@"fields"]; [[[fbsdkgraphrequest alloc] initwithgraphpath:@"me" parameters:parameters] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { ahandler(result, error); }];
Comments
Post a Comment