【问题标题】:An Example of the firebase FIRUser.sendEmailVerificationWithCompletion(FIRUser) function swift IOSfirebase FIRUser.sendEmailVerificationWithCompletion(FIRUser) 函数 swift IOS 的示例
【发布时间】:2016-06-16 21:59:36
【问题描述】:

http://cocoadocs.org/docsets/FirebaseAuth/3.0.2/Classes/FIRUser.html#//api/name/sendEmailVerificationWithCompletion:

https://firebase.google.com/docs/reference/ios/firebaseauth/interface_f_i_r_user#method-detail

谁能给我一个如何使用这个功能的例子? 我将不胜感激有关在括号内键入内容的任何帮助。 链接对这个函数做了一些解释。

【问题讨论】:

  • 嘿@marc,如果您还有其他问题,请告诉我。如果没有,您可以将我的答案设置为接受吗?谢谢!

标签: swift firebase firebase-authentication


【解决方案1】:

正如您在文档中看到的,回调是可选。这是一个将在电子邮件验证完成后立即调用的函数。所以你应该使用这个参数在验证完成后调用任何你想要的逻辑。

在以下示例中,验证在 IBAction 中调用,完成后会测试是否发生任何错误。

@IBAction func didRequestVerifyEmail(sender: AnyObject) {
     FIRAuth.auth()?.currentUser?.sendEmailVerificationWithCompletion({ (error) in
          if let error = error {
            print(error.localizedDescription)
            return
          }
          print("Sent")
     })
}

【讨论】:

    猜你喜欢
    • 2018-05-13
    • 2017-12-07
    • 2018-07-02
    • 2016-10-13
    • 2021-01-12
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多