【发布时间】:2021-08-11 23:51:39
【问题描述】:
TL;DR
我正在使用 FCM 检测卸载。如果我在发送通知时收到NotRegistered token,我认为该应用程序已被卸载。
在 Android 上一切正常,而在 IOS 上我总是收到 success 响应,即使应用程序已卸载数天。
更多信息
我有read,可以使用APNs feedback Service 检测卸载,Apple 会报告任何非活动令牌。
我还在 Firebase 官方 documentation 上看到:
content_available - 在 iOS 上,使用此字段表示 APNs 负载中的内容可用。当发送通知或消息并将其设置为 true 时,将唤醒不活动的客户端应用程序,并通过 APNs 作为静默通知发送消息,而不是通过 FCM 连接服务器。
为了通过 APN 发送通知,我尝试使用 content_available: true 发送推送通知,但我无法在 IOS 上重现 NotRegistered token 错误。它仍然返回success 消息。
我正在使用sendMulticast 发送通知。我的有效载荷:
const payload = {
notification: {
title: text,
},
android: {
priority: "high",
ttl: 60 * 60 * 1,
collapseKey: "yo",
notification: {
channel_id: 'YO',
tag: userDoc.id,
},
},
apns: {
payload: {
aps: {
sound: "reminder.caf",
"content-available": 1,
}
},
headers: {
"apns-collapse-id": "yo",
"apns-priority": "10"
}
},
priority: 10
}
我也无法通过 HTTP 请求重现 NotRegistered token 响应:
curl -X POST \
https://fcm.googleapis.com/fcm/send \
-H 'authorization: key=server_key_here' \
-H 'content-type: application/json' \
-d '{
"to": "fcm_token_here",
"priority": "high",
"content_available": true,
"notification": {
"empty": "body"
},
"data": {
"key1": ""
}
}'
底线
1.如何使用 FCM 检测 IOS 卸载?
2.如果不能,如何检测IOS上的卸载?
【问题讨论】:
-
我在引用相同的资源后遇到了同样的问题。你有没有发现如何解决它?
-
不幸的是还没有:/
标签: ios node.js firebase-cloud-messaging apple-push-notifications