There's a related question but is 4 months old and has no answers: PHP Apple iOS Push Notifications: Command2 : Binary Interface and Notification Format
I'm migrating my push notifications from command 0 format to command 2.
I'm using apple docs https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html and I can't find what im doing wrong. Im using php by the way.
for commmand 0: (it works)
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
for command 1: (it works)
$msg =
chr(1)
. chr(1).chr(1).chr(1).chr(1) //id 1111
. pack('N', time() + 86400) //tomorrow expiration date
. pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
for command 2: (doesn't work)
$msgInner =
chr(1)
. pack('n', 32)
. pack('H*', $deviceToken)
. chr(2)
. pack('n', strlen($payload))
. $payload
. chr(3)
. pack('n', 4)
. chr(1).chr(1).chr(1).chr(1)
. chr(4)
. pack('n', 4)
. pack('N', time() + 86400)
. chr(5)
. pack('n', 1)
. chr(10);
$msg=
chr(2)
. pack('n', strlen($msgInner))
. $msgInner;
the notification doesn't arrive neither the command 8 response packet