FirebaseUI-iOS: Type 'ViewController' does not conform to 'FUIAuthDelegate'

I was trying to implement Firebase Phone Auth UI into my app. Added following pods to my podfile: pod ‘Firebase’ pod ‘Firebase/Auth’ pod ‘FirebaseUI/Phone’

Installed pods and added following code to initiate Phone Auth Process: ` let authVC = FUIAuth.defaultAuthUI() authVC?.delegate = self as! FUIAuthDelegate

	let phone = FUIPhoneAuth(authUI: authVC!)
	authVC?.providers = [phone]
	phone.signIn(withPresenting: self)`

Then implemented FUIAuthDelegate like this: `extension LoginSignupViewController : FUIAuthDelegate { /** @fn authUI:didSignInWithUser:error: @brief Message sent after the sign in process has completed to report the signed in user or error encountered. @param authUI The @c FUIAuth instance sending the message. @param user The signed in user if the sign in attempt was successful. @param error The error that occurred during sign in, if any. */ func authUI(_ authUI: Auth, didSignInWith user: User?, error: Error?) {

}

}`

Now I am getting :

Type ‘ViewController’ does not conform to ‘FUIAuthDelegate’ error see attached screen shot for same.

c1183ef6-4793-11e7-8393-96a1b00224bb

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

If you have another User class defined within your project, this will cause a namespace conflict. Changing the delegate method to below will fix problem:

func authUI(_ authUI: FUIAuth, didSignInWith user: FirebaseAuth.User?, error: Error?) {
       // ...
}

Another solution would be to typealias FirebaseAuth.User back to FIRUser and use FIRUser in your code instead. i.e. typealias FIRUser = FirebaseAuth.User

Can confirm, The project now works with FirebaseAuth.User?

Many thanks @ocwang using your way its working. You are right there is another class named User in my app, which leads to this issue.

func authUI(_ authUI: FUIAuth, didSignInWith user: FirebaseAuth.User?, error: Error?) { // … }

This is working fine now.