【发布时间】:2017-03-22 21:02:45
【问题描述】:
Apple 将 APNs Auth Key 更改为 p8 后,https://github.com/immobiliare/ApnsPHP 等当前库仍然使用旧的 pem 和 cert 文件连接
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'server_certificates_bundle_sandbox.pem'
);
// Set the Provider Certificate passphrase
// $push->setProviderCertificatePassphrase('test');
// Set the Root Certificate Autority to verify the Apple remote peer
$push->setRootCertificationAuthority('entrust_root_certification_authority.pem');
// Connect to the Apple Push Notification Service
$push->connect()
使用 Node.js 示例 (https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/),我可以这样发送:
var apnProvider = new apn.Provider({
token: {
key: 'APNsAuthKey_Q34DLF6Z6J.p8', // Path to the key p8 file
keyId: 'Q34DLF6Z6J', // The Key ID of the p8 file (available at https://developer.apple.com/account/ios/certificate/key)
teamId: 'RLAHF6FL89', // The Team ID of your Apple Developer Account (available at https://developer.apple.com/account/#/membership/)
},
production: false // Set to true if sending a notification to a production iOS app
});
如何像在 node.js 中一样使用 PHP 向 iOS 发送远程通知?
【问题讨论】:
-
你有解决办法吗? :)
-
@Maximus1809 还没有:)
-
我也在寻找一种方法来做到这一点,看来我得想办法了
-
这个库支持你所需要的github.com/edamov/pushok
标签: php ios apple-push-notifications apn apns-php