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

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

问题描述



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

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

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

为了从AppStore(例如TestFlight)接收App的推送通知,我不得不说: p>

  kGGLInstanceIDAPNSServerTypeSandboxOption:@NO}; 

现在我在Firebase中找不到这样的内容。首先,我认为伟大的没有改变这些愚蠢的价值观了。但是现在我不再在我的TestFlight应用程序中收到任何推送通知。



在我的调试控制台中,当我在设备上调试时,输出如下所示:

 < FIRInstanceID /警告> APNS环境中的配置文件:development 

这对本地调试很有用,但在TestFlight中不需要。 (我不知道TestFlight应用是否会发生这种情况,因为我没有控制台。)

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



谢谢,

Simon
<解决方案我解决了这个问题,将下面的代码添加到项目中。

FIRInstanceIDAPNSTokenType.Sandbox将被使用当你通过TestFlight,

和FIRInstanceIDAPNSTokenType.Prod安装应用程序时,当你的应用程序在App Store上线的时候。

  {
FIRInstanceID.instanceID()。setAPNSToken(deviceToken,type:FIRInstanceIDAPNSTokenType.Sandbox)
FIRInstanceID.instanceID()。 setAPNSToken(deviceToken,type:FIRInstanceIDAPNSTokenType.Prod)
}


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

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};

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

kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

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

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.)

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

Thanks,

Simon

解决方案

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

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天全站免登陆