Hey all!
Been having trouble with my Swift code creating a phone verification app.
I have a Verify Phone Number View Controller and a Verification View Controller.
The code on the Verify Phone Number View Controller works fine but the Verification View Controller I’m having problems with, please help! Please see code below!
I am getting the error -> Value of type ‘AuthDataResult’ has no member ‘phoneNumber’ & Value of type ‘AuthDataResult’ has no member ‘providerData’
Don’t know whats going on.
@IBAction func verifyTapped(_ sender: Any) {
let defaults = UserDefaults.standard
let credential: PhoneAuthCredential = PhoneAuthProvider.provider().credential(withVerificationID: defaults.string(forKey: “authVerificationID”)!, verificationCode: otpCodeTextField.text!)
Auth.auth().signIn(with: credential) { (user, error) in
if error != nil {
print(“error: (String(describing: error?.localizedDescription))”)
} else {
print("Phone number: \(String(describing: user?.phoneNumber))")
let userInfo = user?.providerData[0]
print("Provider ID: \(String(describing: userInfo?.providerID))")
self.performSegue(withIdentifier: "logged", sender: Any?.self)
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}