I am working on an ios app which requires Facebook Login.I have successfully implemented the login process.But now I am not able to find that how and where can i get the use
Below is the code for getting person public_profile using latest Facebook SDK v4.0.1. You need to use FBSDKProfile to get person profile.
-(void)viewDidLoad{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
[self.view addSubview:loginButton];
self.loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends"];
self.loginButton.delegate = self;
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(profileUpdated:) name:FBSDKProfileDidChangeNotification object:nil];
}
-(void)profileUpdated:(NSNotification *) notification{
NSLog(@"User name: %@",[FBSDKProfile currentProfile].name);
NSLog(@"User ID: %@",[FBSDKProfile currentProfile].userID);
}
- (void) loginButton:(FBSDKLoginButton *)loginButton
didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result
error:(NSError *)error{
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton{
}