Push notification 为什么使用';地点';有效负载中断推送通知中?
我正在努力从解析云代码中发送推送负载中的地理点。如代码中所述,如果我注释掉添加Push notification 为什么使用';地点';有效负载中断推送通知中?,push-notification,parse-platform,apple-push-notifications,Push Notification,Parse Platform,Apple Push Notifications,我正在努力从解析云代码中发送推送负载中的地理点。如代码中所述,如果我注释掉添加'latitude':location.latitude的行,我的推送通知就会到达 然而,当该行进入时,调用了success,但是在Parse push控制面板中,push显示为有0个收件人。当然,它永远不会到达另一端 Location.latitude不为空,它是正常的长十进制。位置是一个地理点,即“位置”:{“\uuu类型”:“地理点”,“纬度”:0.40281958847904,“经度”:-0.337979459
'latitude':location.latitude
的行,我的推送通知就会到达
然而,当该行进入时,调用了success
,但是在Parse push控制面板中,push显示为有0个收件人。当然,它永远不会到达另一端
Location.latitude不为空,它是正常的长十进制。位置是一个地理点,即“位置”:{“\uuu类型”:“地理点”,“纬度”:0.40281958847904,“经度”:-0.337979459707093}
帮忙
另外一点信息是,设置此键将从Parse Push控制台中“target”下的频道列表中删除“apple”。上一个包含键,下一个不包含:
至于iOS:
您的通知负载看起来很好,也很复杂,您确定您能满足230字节左右的限制(绝对限制为256字节,但标头也会消耗一些字节)
(如果您的案例中的所有字符串都在5-10个字符左右,您可以轻松达到限制)
您可以尝试将所有字段截断为单/双字母值('senderName'->'sn')
对于其他平台,您也可以尝试将location.latitude转换为只有4-6位小数的字符串
var pushData = {
'aps': {
'alert':'Here lies treasure ' + placeName,
'badge':'Increment',
'priority':10,
'sound':"Ting.caf",
'content-available':1
},
'latitude': location.latitude, // if I comment this line out everything works fine
'senderName':senderName,
'sender': senderID,
'request': request.id
};
Parse.Push.send({
channels: [recipient],
data: pushData
}, {
success: function() {
console.log("Pushed for " + recipient);
},
error: function(error) {
console.log("Error " + JSON.stringify(error) + " sending push for " + recipient);
}
});