错误“verifyPhoneNumber:不推荐使用
PhoneAuthProvider.provider().verifyPhoneNumber(PhoneNum.text!) { (verificationID, error) in
if let error = error {
print(error.localizedDescription)
}
// Sign in using the verificationID and the code sent to the user
else {
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
self.performSegue(withIdentifier: "segue", sender: self)
}
}
答案 0 :(得分:0)
我也遇到类似的问题,我按照@bojeil的链接进行操作,但我没有收到所有警告。 注意:我使用的是没有Pods的Firebase。 以下是我的代码:
let alert = UIAlertController(title: "Double-Check:", message: "Is this your correct mobile number? We'll send a text message with a confirmation code to this number:\n \(userMobileNumber.text!)", preferredStyle: .alert)
let action = UIAlertAction(title: "Yes, Send", style: .default) {
(alert: UIAlertAction!) in PhoneAuthProvider.provider().verifyPhoneNumber(fullMobileNumber, uiDelegate: nil) {
(verificationID, error) in if error != nil {
print("error: \(String(describing: error?.localizedDescription))")
} else {
let defaults = UserDefaults.standard
defaults.set(verificationID, forKey: "authVID")
// MARK:- Activity Indicator code begins
// MARK:- Activity Indicator ends
self.performSegue(withIdentifier: "verifyCode", sender: Any?.self)
}
}
}