New to facebook sdk, and can't find a suitable answer to this. I am using facebook sdk to only log in to my iOS application. On login, I want to get the username and email address of the logged in person. How can I get those details without using FacebookGraph API
Asked
Active
Viewed 2,423 times
1 Answers
2
check this ...
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error {
switch (state) {
case FBSessionStateOpen:
if (!error) {
// We have a valid session
NSLog(@" Info : Valid FBSession found...");
[self fetchFacebookUserInfo];
}
break;
case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed: {
NSLog(@" Info : No Valid FBSession found***");
}
break;
default:
break;
}
}
- (void)fetchFacebookUserInfo {
if ([self sessionIsOpen]) {
[FBRequestConnection startForMeWithCompletionHandler:^(FBRequestConnection *connection,
id<FBGraphUser> user,
NSError *error) {
if (!error) {
NSLog(@"Username %@",user.name);
NSLog(@"Email %@",[user objectForKey:@"email"]);
}
}
}

Vaisakh
- 2,919
- 4
- 26
- 44
-
it will not return Username can we ? – Jignesh B Jun 02 '14 at 12:24