12.0.1X.X.X (if issue is Swift related)[Cocoapods] version 8.0.0Login into Facebook on iOS 14 iPad device
If the Facebook Login dialog/view is tapped outside the dialog disappears and it Facebook should return the user canceled response or dialog should not be allowed to be dismissed by tapping outside the dialog
When Facebook Login dialog is dismissed, there is no response from Facebook
Precondition: iPad with iOS14
When you call the following method, with the handler if the Facebook login dialog is dismissed by tapping outside the dialog box, it should callback on the handler with FBSDKLoginManagerLoginResult( isCancelled ) response or dialog should be not cancellable by tapping outside
- (void)logInWithPermissions:(NSArray<NSString *> *)permissions
fromViewController:(UIViewController *)fromViewController
handler:(FBSDKLoginManagerLoginResultBlock)handler
[facebookLoginManager logInWithPermissions:@[@"email", @"public_profile"]
fromViewController:self handler:^(FBSDKLoginManagerLoginResult * _Nullable result, NSError * _Nullable error) {
if(error != nil){
NSLog(@"Login with error: %@",error.localizedDescription);
return;
}
if(result.isCancelled){
NSLog(@"Login is cancelled");
}else{
NSLog(@"Login with token: %@",result.token);
}
}];
Same issue. In my experience, Facebook Login Screen immediately closes after asking permissions page appears with no response on iPhone 11 Pro with iOS 14.0 & Unity SDK 2018.4.23f1
~I 'm getting this error as soon as I login form closes. I have fbauth2 entry in Info.plist though~
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn鈥檛 be completed. (OSStatus error -10814.)"
Nevermind, that was indicating that only Facebook App is not installed. So not relevant with the issue
Okay, I put some logs into code and something looks wrong.
2020-10-09 12:30:51.876991+0300 somegame[1016:305352] FACEBOOK: openURLWithSafariViewController:
2020-10-09 12:30:51.877114+0300 somegame[1016:305352] FACEBOOK: setSessionCompletionHandlerFromHandler
2020-10-09 12:30:51.877160+0300 somegame[1016:305352] FACEBOOK: openURLWithAuthenticationSession
2020-10-09 12:30:51.880260+0300 somegame[1016:305352] FACEBOOK: starting session with SFAuthenticationSession
2020-10-09 12:30:53.915272+0300 somegame[1016:305352] FACEBOOK: applicationDidBecomeActive: isRequestingWebAuthenticationSession=NO, _authenticationSessionState=3, _authenticationSession=YES, Safari View Controller: (null)
2020-10-09 12:30:53.915333+0300 somegame[1016:305352] FACEBOOK: _cancelBridgeRequest
2020-10-09 12:30:53.915348+0300 somegame[1016:305352] FACEBOOK: applicationDidBecomeActive: notExpectingBackground
After Facebook initiates Authentication with SFAuthenticationSession, applicationDidBecomeActive triggers immediately.
and this lines become TRUE, https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKCoreKit/FBSDKCoreKit/Internal/BridgeAPI/FBSDKBridgeAPI.m#L122
and cancels the authentication request due to missing _safariViewController and _expectingBackground is NO in this case.
I put some more logs into FBSDKApplicationDelegate and here is the final logs:
2020-10-09 12:43:58.562781+0300 somegame[1069:311576] FACEBOOK: openURLWithSafariViewController:
2020-10-09 12:43:58.562897+0300 somegame[1069:311576] FACEBOOK: setSessionCompletionHandlerFromHandler
2020-10-09 12:43:58.562950+0300 somegame[1069:311576] FACEBOOK: openURLWithAuthenticationSession
2020-10-09 12:43:58.565728+0300 somegame[1069:311576] FACEBOOK: starting session with SFAuthenticationSession
2020-10-09 12:43:58.660709+0300 somegame[1069:311576] FACEBOOK DELEGATE: applicationWillResignActive
2020-10-09 12:44:00.358034+0300 somegame[1069:311576] FACEBOOK DELEGATE: applicationDidBecomeActive
2020-10-09 12:44:00.358081+0300 somegame[1069:311576] FACEBOOK: applicationDidBecomeActive: isRequestingWebAuthenticationSession=NO, _authenticationSessionState=3, _authenticationSession=YES, Safari View Controller: (null)
2020-10-09 12:44:00.358111+0300 somegame[1069:311576] FACEBOOK: _cancelBridgeRequest
2020-10-09 12:44:00.358128+0300 somegame[1069:311576] FACEBOOK: applicationDidBecomeActive: notExpectingBackground
Hi @ssh-pm
Just hit the same issue. What I did is to make sure I'm presenting the login dialog from my root view controller, and then to override the presentation as such:
override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
super.present(viewControllerToPresent, animated: flag, completion: completion)
if #available(iOS 13, *) {
viewControllerToPresent.isModalInPresentation = true
} else {
viewControllerToPresent.isModalInPopover = true
}
}
Which solves the issue until there is an official version.
All the best.
Most helpful comment
Hi @ssh-pm
Just hit the same issue. What I did is to make sure I'm presenting the login dialog from my root view controller, and then to override the presentation as such:
override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) { super.present(viewControllerToPresent, animated: flag, completion: completion) if #available(iOS 13, *) { viewControllerToPresent.isModalInPresentation = true } else { viewControllerToPresent.isModalInPopover = true } }Which solves the issue until there is an official version.
All the best.