我正在尝试使用Facebook功能实现登录,但我收到了以下错误.
登录失败,错误:无法完成操作.(com.facebook.sdk.login错误304.)
这是我的代码
- (void)loginWithFacebook {
NSString *const read_actions = @"email";
[[[FBSDKLoginManager alloc] init]
logInWithReadPermissions:@[read_actions] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error) {
NSLog(@"Login Failed with error: %@", error.localizedDescription);
}
else if (result.isCancelled)
{
NSLog(@"Login Failed due to Cancel");
}
else
{
if ([result.grantedPermissions containsObject:read_actions]) {
NSLog(@"Permission granted");
}
}
}];
}
Run Code Online (Sandbox Code Playgroud)