now I used the latest SDK v4.26.0 downloaded from here and I followed the link for steps to install for FB. and my code is
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
if ([[[UIDevice currentDevice] systemVersion] floatValue] <= 9) {
// After iOS9 we can not use it anymore
login.loginBehavior = FBSDKLoginBehaviorSystemAccount;
} else {
login.loginBehavior = FBSDKLoginBehaviorWeb;
}
NSArray *permission = [[NSArray alloc] initWithObjects:@"email",@"public_profile",@"user_friends", nil];
NSLog( @"### running FB sdk version: %@", [FBSDKSettings sdkVersion] );
[login logInWithReadPermissions:permission fromViewController:(UIViewController *)self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
[self removeActivityIndicatorWithBg:activityIndicator];
if (error) {
NSLog(@"Process error");
} else if (result.isCancelled) {
NSLog(@"Cancelled");
} else {
NSLog(@"Logged in%@",result.grantedPermissions);
}
}];
here i used the login behavior as FBSDKLoginBehaviorSystemAccount
and I get the error as
(- error: "The operation couldn’t be completed. -10814)
so in my simulator or device contains no accounts setup in system settings for facebook. then it comes on the following block
if (error) {
NSLog(@"Process error");
}
if I print the error,
No Facebook account.
There are no Facebook accounts configured. You can add or create a Facebook account in Settings.
so I changed the loginBehavior from FBSDKLoginBehaviorSystemAccount
to FBSDKLoginBehaviorWeb
, I got all OP with out error
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…