iOS中的推送通知

iOS中的推送通知,ios,node.js,apple-push-notifications,Ios,Node.js,Apple Push Notifications,我正在尝试在iOS应用程序中实现推送通知,我遵循了教程: 然而,我在nodejs中实现了服务器,我更喜欢使用这个接口。我在服务器中使用的代码如下所示: var apns = require("apns"), options, connection, notification; options = { keyFile : "conf/key.pem", certFile : "conf/cert.pem", debug : true }; connection = new a

我正在尝试在iOS应用程序中实现推送通知,我遵循了教程: 然而,我在nodejs中实现了服务器,我更喜欢使用这个接口。我在服务器中使用的代码如下所示:

var apns = require("apns"), options, connection, notification;

options = {
   keyFile : "conf/key.pem",
   certFile : "conf/cert.pem",
   debug : true
};

connection = new apns.Connection(options);

notification = new apns.Notification();
notification.device = new apns.Device("iphone_token");
notification.alert = "Hello World !";

connection.sendNotification(notification);
当我在iPhone上运行服务器端和应用程序时,我没有遇到错误。但是,我的手机没有收到推送通知

我已经检查了防火墙,它已经关闭了


您对这个问题有什么想法吗?

只是想再次检查您是否使用了真正的设备令牌,而不是iphone\u令牌作为您的设备令牌。就在“发送第一次推送通知”部分向您展示如何获取令牌之前,我使用函数didRegisterForRemoteNotificationsWithDeviceToken生成的令牌,并在应用程序委托中定义了此函数。