郭靖丶 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 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 关于#python#的问题:自动化测试
    • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题