[英]Push notifications via FCM server send not received by all iOS devices
We have an issue with push notifications sent to a topic from our server. 我们从服务器发送到主题的推送通知存在问题。 Actually, it isn't the sending part, it is the receiving .
实际上,它不是发送方 ,而是接收方 。 That push notifications are received by some iOS devices but not all .
该推送通知是由某些 iOS设备接收的,但不是全部 。 We haven't had issues with Android devices, we had one report regarding Android but I think that's a hoax.
我们没有遇到Android设备方面的问题,我们有一份有关Android的报告,但我认为这是一个骗局。
We build a request in PHP: 我们用PHP建立一个请求:
$topic = '/topics/urgent_de';
$data = [
'to' => $topic,
'priority' => 'normal',
'notification' => [
'title' => $pushNotification->title_de,
'body' => $pushNotification->text_de,
'topic' => 'urgent',
'target' => $pushNotification->deeplink
],
'data' => [
'title' => $pushNotification->title_de,
'message' => $pushNotification->text_de,
'topic' => 'urgent',
'target' => $pushNotification->deeplink
]
];
Devices register on this topic using: 设备使用以下方法在此主题上注册:
let sub:SupportedLanguage = UrlHelper.getBestSupportedLanguage() == .de ? .de : .en
static let topicUrgent = "/topics/urgent"
static let topicUrgentLocalizedPrefix = "urgent_"
let localizedUrgent = "\(Constants.Push.topicUrgentLocalizedPrefix)\(sub.rawValue)"
Messaging.messaging().subscribe(toTopic: localizedUrgent)
LoggingHelper.info("Subscribed to topic: \(localizedUrgent)")
Messaging.messaging().subscribe(toTopic: Constants.Push.topicUrgent)
LoggingHelper.info("Subscribed to topic: \(Constants.Push.topicUrgent)")
This means, each device subscribes not only to a localized but also a general topic. 这意味着,每个设备不仅订阅本地化主题,还订阅一般主题。
We sent out a few pushes within two weeks last September and some devices in our company received them, some didn't. 去年9月,我们在两周内发出了几次推送,但公司中的某些设备收到了请求,有些则没有。 It didn't depend on their app or iOS version.
它不取决于他们的应用程序或iOS版本。 They all have given permission to receive pushes.
他们都获得了接受推送的许可。 They were all online and running when we sent that push.
当我们发送该推送时,它们都已联机并正在运行。 None of the devices had our app in foreground.
没有设备将我们的应用程序放在前台。 Some haven't started the app for a few weeks some had them open that same day.
有些人已经有几个星期没有启动该应用了,有些人当天才打开。
All in all, when we look at all devices in our company, only half of them receive those push notifications. 总而言之,当我们查看公司中的所有设备时,只有其中一半会收到这些推送通知。
This is a simple check, but worth trying. 这是一个简单的检查,但值得尝试。
Please check that you have enabled push notifications on the devices that don't receives the push notifications. 请检查您是否在未接收到推送通知的设备上启用了推送通知。
Also, please check that "Authorization" request for notifications on iOS handles different iOS versions (Swift/iOS) because they are not the same, it may vary. 另外,请检查iOS通知的“授权”请求是否处理了不同的iOS版本(Swift / iOS),因为它们不相同,可能会有所不同。
Let me know... 让我知道...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.