- Purpose: 为苹果的app - push message . 使用苹果的 push 服务器
- rails 的插件:apple_push_notification
URL: https://github.com/samsoffes/apple_push_notification
- install plugin apple_push_notification
一般都以插件安装script/plugin install git://github.com/samsoffes/apple_push_notification.git
- download certificate file
下载方法,参考: http://www.cnblogs.com/zhw511006/archive/2010/09/01/1815089.html
- Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key.
- Right click and choose
Export 2 items...
. - Choose the p12 format from the drop down and name it
cert.p12
.
是需要输入密码的openssl pkcs12 -in cert.p12 -out apn_development.pem -nodes -clcerts && rm -f cert.p12
- 将apn_development.pem文件发到config/certs/文件夹中
mkdir config/certs mv apn_development.pem config/certs
- #config/enviroment.rb
ApplePushNotification.apn_enviroment = Rails.env.to_sym
- ruby script/console
>> token = "XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX" >> d = Object.new >> d.extend ApplePushNotification >> d.device_token = token >> d.send_notification :alert => "So flexible" >> nil
rails开发利器:如何给苹果PushServer发送消息rails for apple_push_notification
最新推荐文章于 2018-08-23 11:58:17 发布