ios - Facebook login returning null for name result -
i trying use new facebook 4.0 sdks, quite confused how name once permissions. nslog returns null value reason?
fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; [login loginwithreadpermissions:@[@"public_profile"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error) { // process error } else if (result.iscancelled) { // handle cancellations } else { //success _nam = [fbsdkprofile currentprofile].name; nslog(@"name %@", _nam); }}];
this ended solving it.
fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; [login loginwithreadpermissions:@[@"public_profile"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error) { // process error } else if (result.iscancelled) { // handle cancellations } else { [[[fbsdkgraphrequest alloc] initwithgraphpath:@"me" parameters:nil] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { if (error) { } else { nsstring *userid = [[fbsdkaccesstoken currentaccesstoken] userid]; nsstring *username = [result valueforkey:@"name"]; }}]; }}];
Comments
Post a Comment