郭靖丶 2014-01-16 14:54 采纳率: 0%
浏览 2623

node-apn推送消息时513错误是什么意思?

var  apn=require("apn")

var token = '60c3b0b7 b6c464f0 e86bf6f0 ac1fc3d3 26701bae fae89183 4c2d80d9 51811965'; //长度为64的设备Token

var options = { "gateway": "gateway.sandbox.push.apple.com"
,"cert": "./pro_mic_cer.pem",
    "key": "./pro_mic_key.pem"
},
apnConnection = new apn.Connection(options),
device = new apn.Device(token),
note = new apn.Notification();

note.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.
note.badge = 3;
note.sound = "ping.aiff";
note.alert = "\uD83D\uDCE7 \u2709 You have a new message";
note.payload = {'messageFrom': 'Caroline'};

apnConnection.pushNotification(note, device);

apnConnection.on('connected',function() {
console.log("Connected");
});
apnConnection.on('transmitted',function(notification, device) {
console.log("Notificationtransmitted to:" + device.token.toString('hex'));
});
apnConnection.on('transmissionError',function(errCode, notification, device) {
console.error("Notificationcaused error: " + errCode + " for device ",     device,notification);
});
apnConnection.on('timeout',function () {
console.log("ConnectionTimeout");
});
apnConnection.on('disconnected',function() {
console.log("Disconnectedfrom APNS");
});
apnConnection.on('socketError',console.error);

然后会报错:
Notificationcaused error: 513 for device { token: f0 e8 6b f6 f0 ac 1f c3 d3 26 70 1b ae fa e8 91 83 4c 2d 80 d9 51 81 19 65> } {
encoding: 'utf8',
payload:
{ messageFrom: 'Caroline',
aps:
{ badge: 3,
sound: 'ping.aiff',
alert: '� ✉ You have a new message' } },
expiry: 1389887110,
identifier: 0,
priority: 10,
retryLimit: -1,
device: undefined,
alert: '� ✉ You have a new message',
badge: 3,
sound: 'ping.aiff',
newsstandAvailable: undefined,
contentAvailable: undefined,
mdm: undefined,
compiled: true,
truncateAtWordEnd: false,
urlArgs: undefined,
compiledPayload: '{"messageFrom":"Caroline","aps":{"badge":3,"sound":"ping.ai
f","alert":"� ✉ You have a new message"}}' }

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)