如题: 参考资料http://iosshare.cn/?p=1133 其中制作cert.pem 和 key.pem都成功 代码使用的是
var options = {
cert: '../pem/apns-prod-cert.pem', /* Certificate file path */
key: '../pem/apns-prod-key.pem', /* Key file path */
gateway: 'gateway.sandbox.push.apple.com',/* gateway address gateway.push.apple.com, port 2195*/
port: 2195, /* gateway port */
errorCallback: errorHappened , /* Callback when error occurs function(err,notification) */
};
var apnsConnection = new apns.Connection(options);
var myDevice = new apns.Device(goodToken);
var note = new apns.Notification();
note.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.
note.badge = 1;
note.sound = 'ping.aiff';
note.alert = 'You have a new message';
note.payload = {'messageFrom': 'Caroline'};
apnsConnection.pushNotification(note,myDevice);
note.device = myDevice;
apnsConnection.sendNotification(note);
当前确定这段代码是执行了的,没有问题,但是我的iphone设备无法接收到通知。 请问有没有哪位大侠曾经做过类似的东西,指点一二!
4 回复