小智 12

在您的应用程序委托的application(_:open:options:)方法中,调用Auth.auth().canHandle(url).


Lan*_*ria 5

对于空白的重新验证码页面问题,我可以通过执行以下 3 件事来解决它:

第一件事——

  1. 里面的GoogleSerivce-Info.plist文件确认REVERSED_CLIENT_ID被添加到您的项目通过使用此URL类型。遵循第二步的第一部分:将自定义 URL 方案添加到您的 Xcode 项目(查看屏幕截图)。

在此处输入图片说明

第二件事——

  1. 在项目导航器中选择 blue project icon

  2. 选择 Capabilities

  3. 打开 Background Modes

  4. 选择 Background fetch

在此处输入图片说明

第三件事——

  1. 在验证电话号码之前 PhoneAuthProvider.provider(auth: Auth.auth())
@IBAction func phoneButton(sender: UIButton) {

    // ***step 5***
    PhoneAuthProvider.provider(auth: Auth.auth())

    PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumberTextField.text!, uiDelegate: nil) {
        (verificationID, error) in
            
        if let error = error {
            print(error.localizedDescription)
            return
        }
            
        guard let verificationId = verificationID else { return }

        // do something with verificationID
    }
}
Run Code Online (Sandbox Code Playgroud)