【问题标题】:PhoneAuthProvider in Kotlin getting implementaion errorKotlin 中的 PhoneAuthProvider 出现实施错误
【发布时间】:2018-06-27 04:29:54
【问题描述】:

当我尝试通过电话身份验证注册用户时,出现运行时错误

kotlin.NotImplementedError: An operation is not implemented: not implemented

我的代码是

val phoneAuth: PhoneAuthProvider = PhoneAuthProvider.getInstance()
    phoneAuth!!.verifyPhoneNumber(
            "+91xxxxxxxxxx",        // Phone number to verify
            60,                 // Timeout duration
            TimeUnit.SECONDS,   // Unit of timeout
            this@MainActivity,               // Activity (for callback binding)
            mCallBacks)

 val mCallBacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
        override fun onVerificationCompleted(p0: PhoneAuthCredential?) {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }

        override fun onVerificationFailed(p0: FirebaseException?) {
            TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
        }

        override fun onCodeSent(p0: String?, p1: PhoneAuthProvider.ForceResendingToken?) {
            super.onCodeSent(p0, p1)
        }

    }

【问题讨论】:

    标签: android firebase kotlin firebase-authentication


    【解决方案1】:

    TODO 基本上会抛出 NotImplementedError。您可以将TODO 替换为// TODO 之类的评论。

    【讨论】:

      【解决方案2】:

      只需从您实现的函数中删除 TODO( ... ) 就可以了!比如

      override fun onNegativeButtonPresssed() {
              TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
          }
      

      从 TODO 中删除。

      【讨论】:

        猜你喜欢
        • 2020-03-02
        • 1970-01-01
        • 1970-01-01
        • 2022-07-30
        • 1970-01-01
        • 2022-08-14
        • 1970-01-01
        • 2019-07-31
        • 1970-01-01
        相关资源
        最近更新 更多