Firebase 云消息传递开发和发布配置文件 [英] Firebase Cloud Messaging development and release profile

查看:12
本文介绍了Firebase 云消息传递开发和发布配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从 Google Cloud Messaging 切换到 Firebase Cloud Messaging.

I recendly swtiched over from Google Cloud Messaging to Firebase Cloud Messaging.

使用 GCM,我必须选择沙盒选项.如此处所述:https://developers.google.com/cloud-messaging/ios/client#obtain_a_registration_token 见第 3 点.

With GCM I had to choose the sandbox option. As described here : https://developers.google.com/cloud-messaging/ios/client#obtain_a_registration_token see point 3.

要在调试模式下接收推送通知,我必须这样做

To receive push notifications in debug mode I had to do something like this

[[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                         kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};

要从 AppStore(例如 TestFlight)接收应用程序中的推送通知,我不得不说:

To receive push notifications in an App from the AppStore (e.g. TestFlight) I had to say:

kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

现在我在 Firebase 中找不到类似的东西.首先,我认为不要再切换这些愚蠢的值了.但现在我不再在我的 TestFlight 应用程序中收到任何推送通知.

Now I can not find something like this in Firebase. First I thought great no switching these stupid values anymore. But now I do not receive any push notifications in my TestFlight apps anymore.

在我的调试控制台中,当我在设备上进行调试时,一个输出是这样的:

In my debug console when I debug on the device one output is like this:

<FIRInstanceID/WARNING> APNS Environment in profile: development

这对本地调试有好处,但在 TestFlight 中不需要.(我不知道 TestFlight 应用程序是否会发生这种情况,因为我没有它们的控制台.)

Which is good for local debugging, but unwanted in TestFlight. (I do not know if this happens for TestFlight apps, since I do not have a console for them.)

所以我的问题是:有人知道我是否可以在 Firebase 中手动更改此 Sandbox 选项吗?

So my question is: Does anybody know if I can manually change this Sandbox option in Firebase anyhow?

谢谢,

西蒙

推荐答案

我通过将以下代码添加到项目中解决了这个问题.

I solved the problem by adding the code below to the project.

FIRInstanceIDAPNSTokenType.Sandbox 将在您通过 TestFlight 安装应用程序时使用,
和 FIRInstanceIDAPNSTokenType.Prod,当您的应用在 App Store 上线时.

FIRInstanceIDAPNSTokenType.Sandbox will be used when you install the app though TestFlight,
and FIRInstanceIDAPNSTokenType.Prod when your app goes live on the App Store.

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) 
{
    FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Sandbox)
    FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.Prod)
}

这篇关于Firebase 云消息传递开发和发布配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆