【发布时间】:2019-07-21 02:21:56
【问题描述】:
我们遇到了从我们的服务器发送到主题的推送通知的问题。实际上,它不是发送部分,而是接收部分。 一些 iOS 设备会收到推送通知,但不是所有。我们没有遇到过 Android 设备问题,我们有一份关于 Android 的报告,但我认为那是个骗局。
技术细节
我们在 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
]
];
设备在此主题上注册使用:
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)")
这意味着,每个设备不仅订阅一个本地化主题,而且订阅一个通用主题。
问题描述
去年 9 月,我们在两周内发出了一些推送,我们公司的一些设备收到了,有些没有。这不取决于他们的应用程序或 iOS 版本。他们都允许接收推送。当我们发送推送时,它们都在线并正在运行。所有设备都没有我们的应用程序在前台。有些人几周没有启动应用程序,有些人在同一天打开了应用程序。
我们已经尝试过的
- 我们尝试了高优先级
- 我们试图找出有多少用户受到影响。但是firebase控制台中的报告似乎不包括iOS设备或firebase无法跟踪iOS设备是否收到推送(当将过滤器“平台/频道”设置为“iOS”或“应用程序”设置为“iOS应用程序”时,收到的号码是“0”但发送到几千)
- 我们将一个没有收到推送的 iOS 设备放在我们的开发 Macbook 上
- 我们尝试检查日志,但(当然)没有输出
- 然后我们从 XCode 部署并向该设备的令牌发送推送,但收到了 => 我们无法重现该问题。
- 然后我们从应用商店卸载了开发版并安装了应用。
- 收到以下推送
- 几个月后,我们再次推送了该主题。没有收到。
- 我搜索了 stackoverflow 和其他资源,但没有找到这个特定问题(通常是没有收到推送或类似的问题)
总而言之,当我们查看公司中的所有设备时,只有一半的设备会收到这些推送通知。
【问题讨论】:
-
对于 iOS,FCM 推送需要 APNS 看看这个stackoverflow.com/questions/41562823/…
标签: ios firebase firebase-cloud-messaging