我想使用FBSDKLoginKit获取用户名和个人资料图片。如何才能实现呢?以下是我的代码。
pod 'FBSDKLoginKit', '~> 4.7'
- (IBAction)fbLoginActionClicked:(id)sender
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login
logInWithReadPermissions: @[@"public_profile"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
}
else if (result.isCancelled)
{
NSLog(@"Cancelled");
}
else
{
NSLog(@"Logged in");
}
}];
}