我正在使用 apn 模块(https://github.com/argon/node-apn)从 NodeJS 向 iPhone 发送推送通知。
我的代码在我的开发机器 (Mac OSX) 上运行良好,并且通过 Apple 沙箱网关 (gateway.sandbox.push.apple.com) 成功推送通知,但是当我将其移动到登台服务器(运行 Ubuntu)时,推送通知失败并显示以下消息:
Error: ENOENT, no such file or directory 'apns-dev-cert.pem'
我正在这样设置 NodeJS apn 对象:
var options = {
cert: "apns-dev-cert.pem",
key: "apns-key.pem",
passphrase: null,
gateway: "gateway.sandbox.push.apple.com",
port: 2195,
enhanced: true,
errorCallback: undefined,
cacheLength: 5
};
在我的开发 Mac OSX 机器上,证书安装在钥匙串中。根据我对 Ubuntu 的有限理解,相当于将证书文件复制到 /etc/ssl/certs。我尝试这样做,并在我的 NodeJS 代码中将路径更改为“/etc/ssl/certs/apn-dev-cert.pem”,但出现了相同的错误消息。
有任何想法吗?