Hey guys, I want to connect my Xcode Project with Firebase to load my Userdata into the database. Although I already used the same code in another project, it doesn't work and throws me the following offer: Thread 1: "Failed to get FirebaseDatabase instance: Specify DatabaseURL within FIRApp or from your databaseForApp:URL: call."
Here is my Code:
I hope someone can help me, thanks in advance!
Here is my Code:
Code Block @objc func registerButtonTapped() { if acceptTermsOfUseSwitch.isOn == true && emailTextField.text?.isEmpty == false && passwordTextField.text?.isEmpty == false { print("Register...") //Authentification Auth.auth().createUser(withEmail: emailTextField.text!, password: passwordTextField.text!) { (data, error) in if let err = error { print(err.localizedDescription) return } guard let newUser = data?.user else { return } let uid = newUser.uid print("User: \(String(describing: newUser.email)) wurde erstellt, ID: \(String(describing: newUser.uid))") //Database self.uploadUserData(uid: uid, email: self.emailTextField.text!) } } else { print("No valid data") } } func uploadUserData(uid: String, email: String) { var ref = DatabaseReference() ref = Database.database().reference().child("users").child(uid) print("Datenbank ID: \(ref)") ref.setValue(["email" : email, "userID" : uid]) print("User data uploaded") //Change VC: let vc = TabBarController() self.dismiss(animated: true, completion: { UIApplication.shared.windows.first?.rootViewController = vc }) }
I hope someone can help me, thanks in advance!