require 'apns'
# APNS.host = 'gateway.push.apple.com'
APNS.host = 'gateway.sandbox.push.apple.com' # sandbox url
APNS.pem = '/path/to/Certificates.pem'
APNS.pass = '<password>'
APNS.port = 2195
tokens = [
'<device token>',
]
notifies = []
tokens.each do |token|
notifies << APNS::Notification.new(token, alert: 'Hello', badge: 1, sound: 'default')
end
APNS.send_notifications(notifies)
gem install apns
(https://github.com/jpoz/APNS)
iOSから取得したPush notification用Tokenが必要
- Certificates.p12をkeychaninから取得
- openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes -clcerts