【问题标题】:Expected 3-4 arguments, but got 2.ts FirebaseX Ionic native plugin预期 3-4 个参数,但得到 2.ts FirebaseX Ionic 本机插件
【发布时间】:2020-10-02 06:52:57
【问题描述】:

我需要将 Firebase Phone Auth 与 FirebaseX 插件一起使用。我试过这样:

 async getVerificationCode(): void {

    const res:any = await this.firebaseX.verifyPhoneNumber('+16505553434', 60);

  }

但它是这样写的:

预期 3-4 个参数,但得到 2.ts(2554) index.d.ts(347, 96): An 未提供“phoneNumber”的参数。

  "@ionic/angular": "5.1.1",
  "@ionic-native/firebase-x": "^5.26.0",
  "firebase": "7.15.0",

知道如何正确使用它吗?

API:

>   verifyPhoneNumber(success: (value: string | object) => void, error:
> (err: string) => void, phoneNumber: string, timeoutDuration?: number):
> Promise<any>;
>     /**
>      * Signs the user into Firebase with credentials obtained using verifyPhoneNumber().
>      * See the Android- and iOS-specific Firebase documentation for more info.
>      * @param {object} credential - a credential object returned by the success callback of an authentication method
>      * @param {function} success - callback function to call on successful sign-in using credentials
>      * @param {function} error - callback function which will be passed a {string} error message as an argument
>      */

【问题讨论】:

    标签: angular typescript firebase ionic-framework cordova-plugins


    【解决方案1】:

    在您的参数之前需要两个回调。试试

    const res:any = await this.firebaseX.verifyPhoneNumber(() => {}, () => {}, '+16505553434', 60);
    

    【讨论】:

    • 非常感谢。这是我第一次将 This Phone Auth 与 FirebaseX 一起使用。这是不同的。
    • 我也没用过。我是根据您提供的 API 提出的建议。
    猜你喜欢
    • 2018-12-24
    • 2022-08-24
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2018-05-19
    • 2023-04-01
    • 2018-11-24
    相关资源
    最近更新 更多