iphone - Best Way To Find a Username From a Facebook ID -
i have facebook user's id. how username?
specifically, using fbfriendpickercontroller
for (id<fbgraphuser> user in self.friendpickercontroller.selection) { nslog(@"the facebook user: %@", user); }
^this outputs stuff name, id, first name, last name, profile photo, not give user's username.
so, in regards fbfriendpickercontroller, best way username of selected user?
you similar when setting friend picker controller:
// initialize friend picker fbfriendpickerviewcontroller *friendpickercontroller = [[fbfriendpickerviewcontroller alloc] init]; ... // ask friend device data friendpickercontroller.fieldsforrequest = [nsset setwithobjects:@"username", nil];
then when friend picker data returned, username info should returned well.
you can implement friend picker delegate method roundabout way of getting username info. implement: friendpickerviewcontroller:shouldincludeuser:
in method, can examine returned data should include username:
- (bool)friendpickerviewcontroller:(fbfriendpickerviewcontroller *)friendpicker shouldincludeuser:(id<fbgraphuserextrafields>)user { nsstring *username = user.username; // process username wish to. return yes; }
for similar ask, in case looking "device" info see doc: https://developers.facebook.com/docs/howtos/filter-devices-friend-selector-using-ios-sdk/
Comments
Post a Comment