node.js 服务器下使用node-apn 做 ios 消息推送
https://github.com/node-apn/node-apn
新版本的node-apn 用的是p8证书 google 了大半天....终于成功了。
https://solarianprogrammer.com/2017/02/14/ios-remote-push-notifications-nodejs-backend/
p8证书 的生成 及使用:
Generate an APNs Auth Key
The next step involves generating an authentication key that will allow your backend server to authenticate with APNs when it wants to send one or more of your devices a push notification.
Up until a few months ago, the alternative to this was a painful process that involved filling out a Certificate Signing Request in Keychain Access, uploading it to the Developer Center, downloading a signed certificate, and exporting its private key from Keychain Access (not to mention converting both certificates to .pem
format). This certificate would then expire and need to be renewed every year and would only be valid for one deployment scheme: Development or Production.
Thankfully, Apple has greatly simplified the process of authenticating with APNs with the introduction of APNs Auth Keys, which never expire (unless revoked by you) and work for all deployment schemes.
Open the Keys -> All page in your Developer Center and click the +
button to create a new Auth Key.
In the next page, enter a name for your key, enable APNs and click Continue at the bottom of the page.
Finally, click Confirm in the next page. Apple will then generate a .p8
key file containing your APNs Auth Key.
Download the .p8
key file to your computer and save it for later. Also, be sure to write down the Key ID somewhere, as you'll need it later when connecting to APNs.
详细说明如下地址:
https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/