郭靖丶 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条回答

    报告相同问题?

    悬赏问题

    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)