I'm trying to install the "drop-in" authentication solution from Firebase that automatically sends your app users through Google, Facebook, or email/password screens to authenticate them.
My problem is that the code provided by Firebase appears to be in the old iOS language of Objective C instead of Swift, and that some of the lines of instructional Swift code appear outdated, and I can't find the new lines I'm supposed to use.
I'm building my code mostly from the instructions on this part of the Github drop-in solution: FirebaseUI Authentication.
This has resulted in the following code, some of which I've had to guess at, since Xcode couldn't recognize .authUI() in let authUI = FIRAuthUI.authUI(). The app doesn't crash, but it's not starting the authentication process at all, either. It's just a blank screen.
import UIKit import Firebase import FirebaseAuth import FirebaseDatabaseUI import FirebaseAuthUI import FirebaseGoogleAuthUI import FirebaseFacebookAuthUI import FBSDKCoreKit import FBSDKLoginKit class LoginController: UIViewController, FIRAuthUIDelegate { var db = FIRDatabaseReference.init() var kFacebookAppID = "15839856152xxxxx" var kGoogleClientID = "9042861xxxxx-6qq4gmeos07gpgmgt54ospv3fvpg0724.apps.googleusercontent.com" override func viewDidLoad() { super.viewDidLoad() //FIRApp.configure() let authUI = FIRAuthUI.defaultAuthUI() let facebookAuthUI = FIRFacebookAuthUI(appID: kFacebookAppID) let googleAuthUI = FIRGoogleAuthUI(clientID: kGoogleClientID) //let emailAuthUI = FIREmailPasswordAuthProvider authUI?.providers = [facebookAuthUI, googleAuthUI] // Present the auth view controller and then implement the sign in callback. let authViewController = authUI authUI?.authViewController() } func authUI(authUI: FIRAuthUI, didSignInWithUser user: FIRUser?, error: NSError?) { if error != nil { //Problem signing in }else { //User is in! } } func application(app: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool { let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String return FIRAuthUI.defaultAuthUI()!.handleOpenURL(url, sourceApplication: sourceApplication ?? "") ?? false } } As a side not, I placed FIRApp.configure() inside the "didFinishLaunchingWithOptions" function in the AppDelegate class, and I have also separated FIRApp.configure() out as an override in the AppDelegate class, as shown below. Nothing seems to help. I've spent about 4 days trying to figure this out. Implementing it for Web and Android only took a few hours.
override init() { super.init() FIRApp.configure() //FIRDatabase.database().persistenceEnabled = true } 