A notice does not reach a terminal. Please let me know. Hello. Thank you.
iPhone 4S iOS 5.1 I wrote the following ruby script. And it performed from the MDM server. However, a notice does not reach an iPhone terminal. Please let me know. A setup by ."mobileconfig" was completed and the topic and the device token have been PUT to the MDM server. It checked that the right information was also acquirable, It is confirmed that renewal of a message or a badge is made to an iPhone terminal in APNs. Only APNs of MDM does not reach an iPhone terminal. I would like to solve this problem. If you please, please help me.
#!/usr/bin/ruby -Ku
require 'openssl'
require 'socket'
(msg = []) << "dd0b64b77ebcac2092d6fe644d4db04e39d577c0228cf2187d8f87966aff8234"
device = msg.pack("H*")
socket = TCPSocket.new('gateway.sandbox.push.apple.com',2195)
#socket = TCPSocket.new('gateway.push.apple.com',2195)
context = OpenSSL::SSL::SSLContext.new('SSLv3')
context.cert = OpenSSL::X509::Certificate.new(File.read('nj_dev_apns-dev.pem'))
context.key = OpenSSL::PKey::RSA.new(File.read('nj_dev_apns-dev-key-noenc.pem'))
ssl = OpenSSL::SSL::SSLSocket.new(socket, context)
ssl.connect
payload = <<-EOS
{
#"mdm":"{<PushMagic>}"
{"mdm":"7C68976X-E70D-485Q-8CA7-7AC48F2F5F4A"}
}
EOS
(message = []) << ['0'].pack('H') << [32].pack('n')
<< device << [payload.size].pack('n') << payload
ssl.write(message.join(''))
ssl.close
socket.close