Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of unresolved identifier 'Auth'

I kept getting this error

Use of unresolved identifier 'Auth'

enter image description here

Auth.auth().createUser(withEmail: email, password: password) { (user, error) in

    let ref = Database.database().reference(fromURL: "https://app-project.firebaseio.com")
    let usersReference = ref.child("Users")
    let id = usersReference.childByAutoId().key

    InstanceID.instanceID().instanceID(handler: { (result, error) in
        let token = result?.instanceID
        let values = ["phone": phone,"CreatedAt":dateString,"UpdatedAt":dateString,"id":id as Any,"token":token as Any] as [String : Any]
        usersReference.child(id!).setValue(values, withCompletionBlock: { (err, ref) in
            if err != nil {
                print(err.self as Any)
                return
            }
            print("Successfully saved user in Firebase DB")

        })

    })

}

Podfile

platform :ios, '10.0'
use_frameworks!

target 'project' do
   pod 'Charts'
   pod 'SwiftyJSON'
   pod 'Firebase/Core'
   pod 'Firebase/Messaging'
   pod 'Firebase/Database'
   pod 'Firebase/Auth'
end

I already use this on top of my file

import Firebase
import FirebaseDatabase

I tried to rebuild, still seeing it.

Restart XCode, rebuild still seeing it.

How would one go about debugging this further?

like image 861
code-8 Avatar asked Dec 06 '18 19:12

code-8


2 Answers

You need to

import FirebaseAuth
like image 191
Sh_Khan Avatar answered Nov 06 '22 02:11

Sh_Khan


let include 'Firebase/Auth' in you pod file.Then type in your terminal pod install.Then import FirebaseAuth.

like image 29
kurupareshan Avatar answered Nov 06 '22 04:11

kurupareshan