【问题标题】:Firebase Auth Phone not working when using for production用于生产时 Firebase Auth Phone 无法正常工作
【发布时间】:2017-06-09 10:41:02
【问题描述】:

所以我已经成功设置了 Firebase 消息,并且推送通知效果很好。但是,当我为手机添加 Firebase 身份验证时,只有沙盒可以工作。以下是我的代码:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeSandbox];
}

使用 FIRAuthAPNSTokenTypeSandbox 时,[[FIRPhoneAuthProvider] verifyPhoneNumber:phoneNumber...] 将起作用。但是,当我使用 FIRAuthAPNSTokenTypeProd 时,我会收到内部服务器错误。我已经在我的 Firebase 控制台上上传了开发和生产证书,当用户通过 Test Flight 下载我的应用时,推送通知效果很好。

我的问题是为什么会这样,我该如何解决?我担心如果我继续使用沙盒,一些未来的用户将无法收到短信,但同时生产也无法工作。

我的另一个问题是,我能否本地化和自定义我的 SMS 消息?我将把这些代码发送给多个国家的用户。

如果有人知道答案,那就太好了!提前致谢!

【问题讨论】:

    标签: ios objective-c firebase firebase-authentication


    【解决方案1】:

    回答你的第一个问题:

    1. 当我为手机添加 Firebase 身份验证时,只有沙盒可以工作。

    请记住,您在使用时使用的证书类型 共享构建,

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    
        // If you are using the development certificate you have to use this,
            [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeSandbox];
    
        // If you are using distribution certificate you should use this
            [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeProd];
    
        // If you want Firebase to automatically detect the type use this.
            [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeUnknown];
    
        }
    
    1. a) 本地化:可以。

    [[FIRAuth auth] useAppLanguage]; 参考:Firebase Phone Number Auth Document

     b) Customize my SMS messages : No you can't.
    
      As this may abuse the user experience. Got clarification from Firebase as "Those templates can't be edited, sorry. There is a good deal of concern that this service could be abused and used for spam and other bad practices."
    

    【讨论】:

    • Firebase 外语短信模板的代码页错误。
    猜你喜欢
    • 2021-07-14
    • 2019-01-19
    • 2021-06-30
    • 2017-04-18
    • 2018-02-09
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    相关资源
    最近更新 更多