从Firebase(或其他平台)发送IOS通知到特定终止 [英] Sending IOS notifications from Firebase (or another platform) to specific terminales

查看:207
本文介绍了从Firebase(或其他平台)发送IOS通知到特定终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们现在能够通过Firebase发送通知给特定的Android设备,我正在尝试对IOS设备做同样的事情。



我们使用POD并安装了

  pod'Firebase / Core'
pod'Firebase / Messaging'



我们已经使用Firebase创建了一个帐户。



我添加了相应的功能AppDelegate.swift。在执行应用程序后,我可以从Firebase发送通知给所有的iPhone ...但没有具体的。



在生产中,我有以下几个元素:
$ pre $ FIRInstanceID.instanceID()。setAPNSToken(deviceToken,tape:FIRInstanceIDAPNSTokenType.prod)

到这里,所有的好处..但是当我尝试从用户获取令牌,然后只发送一个通知给该设备...通知没有到达

标记生成没有任何问题。

  if let refreshedToken = FIRInstanceID.instanceID()。token(){
print(InstanceID token:\(refreshedToken))
}

从firebase发送通知并且不显示错误..但通知从未到达实际的设备。

可以这是用Firebase完成的?
是否有任何其他服务可以让我这样做?

更新

我发送消息给控制台



确保您已经通过下载您的APN密钥并上传到您的Firebase控制台来设置后端:



下载: https:/ /firebase.google.com/docs/cloud-messaging/ios/certs



上传:打开您的Firebase控制台,点击上方的齿轮图标点击项目设置,然后点击云消息传递标签。上传您的APN密钥。



当Firebase启动时(在调试模式下运行应用程序时),您应该能够从调试输出控制台获取FCM设备ID。

We are currently able to send notifications to specific Android devices through Firebase and I am trying to do the same to IOS devices.

We use POD and have installed

pod 'Firebase/Core' 
pod ‘Firebase/Messaging'

We've created an account with Firebase.

I have added the functions that correspond to AppDelegate.swift. After executing the app, I can send notifications from Firebase to all iPhones... but no specific ones.

In production, I have the following

  FIRInstanceID.instanceID().setAPNSToken(deviceToken, tape: FIRInstanceIDAPNSTokenType.prod)

Up to here, all good .. but when I try to get the token from a user and then send a notification only to that device... the notification does not arrive

The token is generated without any problems.

if let refreshedToken = FIRInstanceID.instanceID().token() { 
 print("InstanceID token: \(refreshedToken)") 
 }

From firebase The notification is sent and does not show errors.. but the notification never arrives to the actual device.

Can this be done with Firebase? Is there any other service that would allow me to do this?

UPDATE

I send message for console

click open image

解决方案

On Android, Firebase has the luxury of using GCM directly. For Apple, FCM messages need to be sent to Apple Push Notifications.

Make sure you have setup the backend by downloading your APN Key and uploading to your Firebase console:

Download: https://firebase.google.com/docs/cloud-messaging/ios/certs

Upload: Open your Firebase console, click on the gear icon in the upper left, click on Project settings and then the Cloud Messaging Tab. Upload your APN key there.

You should be able to grab the FCM device ID from the debug output console when Firebase starts up (when running the app in debug mode).

这篇关于从Firebase(或其他平台)发送IOS通知到特定终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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