A gem for the Apple Push Notification Service
C:\Users\user\>gem install apns Fetching: apns-0.9.0.gem (100%) Successfully installed apns-0.9.0 1 gem installed Installing ri documentation for apns-0.9.0... Installing RDoc documentation for apns-0.9.0...
push.rb
require 'rubygems' require 'apns' # https://github.com/jpoz/APNS # APNS.host = 'gateway.push.apple.com' # gateway.sandbox.push.apple.com is default # APNS.pem = '/path/to/pem/file' # this is the file you just created # APNS.port = 2195 # this is also the default. Shouldn't ever have to set this, but just in case Apple goes crazy, you can. APNS.pem = 'C:\Users\APNS\apns.pem' device_token = '123abc456def' APNS.send_notification(device_token, 'Hello iPhone!' ) APNS.send_notification(device_token, :alert => 'Hello iPhone!', :badge => 1, :sound => 'default')
沒有留言:
張貼留言