Firebase 云消息传递开发和发布配置文件

2023-07-29移动开发问题
1

本文介绍了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 云消息传递开发和发布配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

[ios.cocos2d+box2d]如何禁用自动旋转?
[ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)...
2024-08-12 移动开发问题
7

从 Documents 目录存储和读取文件 iOS 5
Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)...
2024-08-12 移动开发问题
9

如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?
How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?(如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?)...
2024-08-12 移动开发问题
13