这是我的代码:
import FirebaseAuth
class AuthPhoneNum {
static func getPhoneNum(phoneNumber: String) {
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber) { (verificationID, error) in
if let error = error {
print(error)
return
}
UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
}
}
static func verify(verificationCode: String?) {
guard let verificationID = UserDefaults.standard.string(forKey: "authVerificationID") else { return }
if verificationCode != nil {
let credential = PhoneAuthProvider.provider().credential(
withVerificationID: verificationID,
verificationCode: verificationCode!)
Auth.auth().signIn(with: credential) { (user, error) in
if let error = error {
print(error)
return
}
}
} else {
print("No verification code") …Run Code Online (Sandbox Code Playgroud) Hi have tried to use the phone authentication from firebase, but it is failing. I have read a lot of question regarding this problem and most of them mentioned to create the apn key in developer.apple.com
Maybe that could work, but the thing is that I have used the phone authentication in another apps that have access to the same firebase project and I didn't add any apn key.
For "Delivery Clientes" I can authenticate using phone number, but for …