How would you test the APNS feedback service in the sandbox? Or in other words, how do you force a device to be in the feedback?
I realize an answer has been accepted for this but in order to do first round of testing without having to constantly install & remove my application from my phone/ipod I created a VERY simple ruby script to act as the feedback server. I configured my ruby APNS class to connect to this server instead (localhost:2196) and read from it. I did NOT init an SSL connection so I just used the base socket instead. Below is the script I used to 'host' the server.
#!/usr/bin/env ruby
require 'socket'
puts 'Opening server'
server = TCPServer.open(2196)
loop {
puts 'Waiting for connection'
client = server.accept
puts 'Connected preparing data'
data = [1, 2, 3, 4, 0, 32, ['d41c3767074f541814c2207b78f72e538569cb39eae60a8c4a8677549819e174']]
puts 'Data for delivery: ' + data.inspect
begin
data[6] = data[6].pack('H*')
data = data.pack('c6a*')
loop {
puts 'Writing Data'
client.write data
puts 'Sleeping for 5 seconds'
sleep 5
}
rescue
end
puts 'Done writing, closing'
client.close
}
This script will listen and when it receives a connection every 5 seconds write a packet to the socket. If the connecting socket closes (for example you kill your feedback process) then this script resets and waits for a new connection.
Remember, do not use the SSL connection stuff just a standard ruby socket. Good luck!