简体   繁体   English

并非所有iOS设备都通过FCM服务器发送推送通知

[英]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的报告,但我认为这是一个骗局。

Technical details 技术细节

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. 这意味着,每个设备不仅订阅本地化主题,还订阅一般主题。

Problem description 问题描述

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. 有些人已经有几个星期没有启动该应用了,有些人当天才打开。

What we already tried 我们已经尝试过的

  1. We tried priority high 我们尝试了高优先级
  2. We tried to find out how many users are affected. 我们试图找出有多少用户受到影响。 But reports in firebase console don't seem to include iOS devices or firebase can't track if a push was received by iOS devices (when setting filter "platform/channel" to "iOS" or "app" to "iOS app", received number is "0" but sent to several thousand) 但是Firebase控制台中的报告似乎不包括iOS设备,或者Firebase无法跟踪iOS设备是否收到了推送(将过滤器“平台/渠道”设置为“ iOS”或将“应用”设置为“ iOS应用”时,收到的数字是“ 0”,但发送到几千)
  3. We put an iOS device which didn't receive one push on our development Macbook 我们在开发Macbook上放置了一口气没有得到推动的iOS设备
    • We tried to check logs but (of course) there was not output 我们尝试检查日志,但是(当然)没有输出
    • Then we deployed from XCode and sent a push to that device's token but it was received => We couldn't reproduce the issue. 然后,我们从XCode进行了部署,并向该设备的令牌发送了推送,但已收到它=>我们无法重现该问题。
    • We then uninstalled the development version and installed app from app store. 然后,我们从应用商店中卸载了开发版本并安装了应用。
    • The following push was received 收到以下推送
    • We sent another push to topic a few months later. 几个月后,我们又对主题进行了推送。 It wasn't received. 没有收到。
  4. I searched stackoverflow and other resources but I didn't find this specific issue (usually it is a problem where no pushes are received or similar) 我搜索了stackoverflow和其他资源,但是没有找到这个特定问题(通常是没有收到推送或类似请求的问题)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM