I am having trouble sending offline push messages to the apple devices. I am using APNS enhanced format and I formatted my packet like the below: (in perl)
print "I will timeout in $timeout \n";
return pack(
'cNNnH*na*', # format
1, # command
$id, # message ID used for error tracking
$timeout, # expiry timestamp
32, # Lenth should always be 32 as per Apples doc
$devicetoken, # token (Hex not string)
bytes::length($json), # payload length
$json # payload
);
This always works when the device is connected to the internet. I tried killing the app, disabling data from the app and it always work. However, it never works when I send the push while the device is offline (eg. in Airplane mode). I am setting the expiry time adding a day with the current epoch time. But it doesnt seem to work. I am not getting any error back from APNS from my side everything looks good. As per my understanding, once I set expiry to a future date APNS should try to send the push later again. I kept on waiting and it never showed up. What can be the possible reason for this What else I may try to check the issue?