我拥有一个发送数据和通知消息的 Cloud Functions 环境。
目前,我正在测试在 iPhone SE (2016) 和 iPhone 7 Plus 上的 FCM 消息 - 这两个设备之间的行为非常不一致,我想知道为什么。
目前,我正在测试在 iPhone SE (2016) 和 iPhone 7 Plus 上的 FCM 消息 - 这两个设备之间的行为非常不一致,我想知道为什么。
- iPhone SE (2016) 正在运行 iOS 14 beta 1
- iPhone 7 Plus 正在运行 iOS 14 beta 3
// These options are global for all my fcm messages
const options = { priority: "high", timeToLive: 30000, content_available: true }
function sendProfile() {
...
const fcmToken = ********
const notif = {
notification: {
title: "test title",
body: "test body"
}
}
admin.messaging().sendToDevice(fcmToken, notif, options);
const dataMsg = {
data: {
id: id,
type: "match",
uid: uid,
name: name,
age: age.toString(),
bio: bio,
img1: String(img1),
img2: String(img2),
img3: String(img3),
pronoun: pronoun,
error: String(bot)
}
}
return admin.messaging().sendToDevice(fcmToken, dataMsg, options);
}
但针对以下函数:
The notification message successfully gets delivered to both devices
But the data message only gets delivered to the iPhone SE (not the iPhone 7 Plus)
function sendPlace(fcmToken, placeSnapshot, matchName){ let docId = placeSnapshot.id; let place = placeSnapshot.data(); console.log("sendPlacee: ", place.name, " to: ", fcmToken); const dataMsg = { data: { type: "place", name: place.name, latitude: place.l.latitude.toString(), longitude: place.l.longitude.toString(), instruction: String(place.instruction), placeId: docId, picture: String(place.picture1), matchName: matchName, address: place.address } } const notif = { notification: { title: "test place function", body: "test the body message" } } admin.messaging().sendToDevice(fcmToken, notif, options) return admin.messaging().sendToDevice(fcmToken, dataMsg, options) }
只有当我删除一些有效负载时,才能成功地发送到iPhone 7 Plus(我从数据有效负载中删除了指令(instruction)
、图片(picture)
和地址(address)
键值-然后它就起作用了)。
这里有什么问题吗?
编辑:我的Android设备没有任何问题。