Firebase电话身份验证非常慢

时间:2019-02-01 03:02:32

标签: ios swift firebase firebase-authentication presentviewcontroller

我正在使用Firebase电话身份验证来验证用户的电话号码,并在创建帐户后登录。我想在下一个屏幕上执行搜索,以输入reCaptcha完成后Firebase auth发送到电话的代码。 reCaptcha屏幕似乎加载非常缓慢,几乎要花整整10秒钟。如果我做错了什么,有什么办法可以加快速度?下面是处理此过程的代码。

PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in
    if let error = error {
        print("An error has occured while trying to authenticate phone number: \(error.localizedDescription)")
        return
    }
    UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
    // Sign in using the verificationID and the code sent to the user
    // ...
    verifyViewController.verificationID = verificationID
    print("Verification id created")

                    let transition = CATransition()
                    transition.duration = 0.03
                    transition.type = CATransitionType.push
                    transition.subtype = CATransitionSubtype.fromRight
                    transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
                    self.view.window!.layer.add(transition, forKey: kCATransition)

                    self.present(verifyViewController, animated: false, completion: {
                        print("presented Verify View Controller")
                    })

}

0 个答案:

没有答案