objective c - Get info user Facebook SDK iOS -
i followed little 'guides online, can not figure out how username of user such facebook. login , session work properly. can not take values of current user. working code
if (!appdelegate.session.isopen) { // create fresh session object appdelegate.session = [[fbsession alloc] init]; // if don't have cached token, call open here cause ux login // occur; don't want happen unless user clicks login button, , // check here make sure have token before calling open if (appdelegate.session.state == fbsessionstatecreatedtokenloaded) { // though had cached token, need login make session usable [appdelegate.session openwithcompletionhandler:^(fbsession *session, fbsessionstate status, nserror *error) { nslog(@"session facebook ok"); // how username ?
thanks in advance
learn how use facebook graph api.
to request user info:
[fbrequestconnection startformewithcompletionhandler:^(fbrequestconnection *connection, id result, nserror *error) { if (!error) { // success! include code handle results here nslog(@"user info: %@", result); } else { // error occurred, need handle error // see: https://developers.facebook.com/docs/ios/errors } }];
Comments
Post a Comment