我目前正在尝试使用firebasephoneauth验证电话号码。在巴基斯坦,英国及周边地区,它的运行情况绝对不错,但是当应用程序用户在美国时,firebase会给出来自firebase的“无效令牌”错误。
func VerfiyPhoneNumber(PhoneNo:String,completionHandler: @escaping ((_ verID: String , _ success: Bool, _ msg: String) -> Void))
{
PhoneAuthProvider.provider().verifyPhoneNumber(PhoneNo, uiDelegate: nil) { (verificationID, error) in
if let error = error {
completionHandler("", false, (error.localizedDescription))
}
else
{
completionHandler(verificationID!,true, "Operation Successfull\nPhone Number Verified.")
}
}
}
VerfiyPhoneNumber(PhoneNo: number, completionHandler: { (verificationID, status, message) in
if status
{
userPrefrences.setValue(verificationID, forKey: PrefrencesKeys.verificationID)
self.present_contact_no_verification()
}
else
{
self.alert(message: message)
}
})
答案 0 :(得分:0)