Error while login with Facebook after xcode 11 and IOS 13 with ParseServer
Issue Description
After updating to xcode11 and ios13 I can not use login with facebook that I was able to use while using ios12.
I researched and learned that with the new sceneDelegate protocol AppDelegate is not working as in the past, however it is not a new project and when I check Info.plist I don't see the "Application Scene Manifest". I am looking for two days and could not found any solution.
I also added iOS 12.4 simulator to xCode 11 and when I try the 12.4 simulator it works, however it does not with the 13.3 simulator. When I click the login with facebook button it directs me to facebook page in iOS12.4. However, in iOS13.3 when I click the button, nothing happens. I just get the print("Uh oh. The user cancelled the Facebook login.") error and nothing else.
Below is the code I use to sign in:
Steps to reproduce
- first I thought it is about the new multiple window properties and tried to add sceneDelegate but it did not work, just got a black screen. Checked everywhere but could not found a solution.
Expected Results
Directed to the facebook login page.
Actual Outcome
Nothing happens, getting the print("Uh oh. The user cancelled the Facebook login.") in the log.
Environment Setup
-
Server
- parse-server version: 2.8.4
- Operating System: IOS Swift 5
- Hardware: Iphone
- Localhost or remote server: AWS Elasticbeanstalk
-
Database
- MongoDB version: 3.6 (driver: 3.1.1)
- Storage engine: mlab.com
Logs/Trace
Below are the AppDelegate codes:
import UIKit
import ParseFacebookUtilsV4
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = ParseClientConfiguration(block: {
(ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "xxxxxxxxxxxxxx";
ParseMutableClientConfiguration.clientKey = "xxxxxxxxxxxxxx";
ParseMutableClientConfiguration.server = "xxxxxxxxxxxxxx";
});
Parse.initialize(with: config);
PFFacebookUtils.initializeFacebook(applicationLaunchOptions: launchOptions)
.
.
.
.
.
.
func application(_ application: UIApplication,
open url: URL,
sourceApplication: String?,
annotation: Any) -> Bool {
print("I was here 3")
return FBSDKApplicationDelegate.sharedInstance().application(application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if #available(iOS 9.0, *) {
print("I was here 4")
return FBSDKApplicationDelegate.sharedInstance().application(
app,
open: url,
sourceApplication: options[.sourceApplication] as? String,
annotation: options[.annotation]
)
}
return true
}
Below are the sign in codes:
PFFacebookUtils.logInInBackground(withReadPermissions: permissions, block: {
(user: PFUser?, error: Error?) -> Void in
if let user = user {
if user.isNew {
print("User signed up and logged in through Facebook!")
} else {
print("User logged in through Facebook!")
}
} else {
print("Uh oh. The user cancelled the Facebook login.")
}
})
I updated the below frameworks to the latest versions and the problem was fixed. FBSDKCoreKit (version 6.0.0) FBSDKLoginKit (version 6.0.0) ParseFacebookUtilsV4