I am trying to log-in on Facebook with AWS IOS SDK, my code as below:
[[AWSFacebookSignInProvider sharedInstance] setPermissions:@[@"public_profile",@"email",@"user_friends"]];
[[AWSFacebookSignInProvider sharedInstance] setViewControllerForFacebookSignIn:self];
[[AWSIdentityManager defaultIdentityManager]
loginWithSignInProvider:[AWSFacebookSignInProvider sharedInstance]
completionHandler:^(id result, NSError *error) {
if (error) {
NSLog(@"^Login in with SignIn Provider has failed: %@", error);
completion(NO);
return;
}
completion(YES);
}];
In response of loginWithSignInProvider, I am getting an error as below:
Error Domain=com.facebook.sdk.login Code=306 "Access has not been granted to the Facebook account. Verify device settings." UserInfo={NSLocalizedDescription=Access has not been granted to the Facebook account. Verify device settings., com.facebook.sdk:FBSDKErrorLocalizedDescriptionKey=Access has not been granted to the Facebook account. Verify device settings.}
Here I am using Xcode 9.2 and IOS 11.0, Can please help me to solve that issue.
Try this:
+ (instancetype)sharedInstance {
static AWSFacebookSignInProviderCustom *_sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [AWSFacebookSignInProviderCustom new];
});
return _sharedInstance;
}
- (void)login
{
if (!self.facebookLogin)
self.facebookLogin = [FBSDKLoginManager new];
[self.facebookLogin logInWithReadPermissions:@[@"public_profile", @"email", @"user_friends"]
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Error!");
} else if (result.isCancelled)
{
// Login canceled, do nothing
NSLog(@"Cancelled!");
} else {
NSLog(@"FSBKDAccess Token: %@", [FBSDKAccessToken currentAccessToken]);
[[AWSFacebookSignInProvider sharedInstance] login];
}
}];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.