Ios facebook sdk error systemlogincancelled
I am getting facebook sdk error on ios when trying to login - note that I just updated my facebook sdk version to 3.21.1. Interestingly, it works great on a simulator. When I login to facebook on my iphone under settings => facebook, the facebook login in my app fails, but when I disable my facebook login it works fine again.
Here is my code:
NSArray * basicPermissions = @[@"public_profile", @"user_friends", @"email"];
[FBSession openActiveSessionWithReadPermissions:basicPermissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
[DCTLogger debug:@"facebookLoginQ:Callback: %@/%p sess=%@ ", [DCTBase stringForFBSessionState:status], error, session];
if (error) {
dispatch_async(q, ^{
handlerCopy(nil, error);
});
return;
}
if (status == FBSessionStateOpen) {
[FBSession setActiveSession:session];
[self facebookSessionCreatedQ:q Callback:handlerCopy];
}
}];
The error I am getting is com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled
with facebook sdk error code 2.
Another interesting point is that if I remove public_profile
from basicPermissions
, the input is fine, and like the other post, I've seen this if I use a deprecated method openActiveSessionWithPermissions
and not openActiveSessionWithReadPermissions
it works great.
Just want to point out again that it only seems unsuccessful if there is a registered facebook account on the device. I feel like maybe the new sdk includes automatically public_profile
, so if I ask for it again in basicPermissions it will cause a problem.
source to share
No one has answered this question yet
Check out similar questions: