Open luckydevil13 opened 9 years ago
I think the issue here is with format of the device_token. Inside the guts of Net::APNs::Extended, it the packing code is this:
n/a*
which would not take anything like the hexadecimal string as input. It would be really nice if the module documented the format for the device_token, expiry and identifier.
I'm sorry, Net::APNs::Extended
is not compatible interface with Net::APNS
.
$device_token
is 32 byte binary format please.
maybe following code is correct.
my $device_token = pack 'H*' => '6DCB004093EE140CBCBF42C400A6327561E29F732AEA72A124E3BBF148230EA1'
Why can't you handle this in module itself? Is there any specific reason behind this?
use Net::APNs::Extended; use Data::Dumper;
my $apns = Net::APNs::Extended->new( is_sandbox => 0, cert_file => 'cert.pem', password => 'passdefined', );
$apns->send( '6DCB004093EE140CBCBF42C400A6327561E29F732AEA72A124E3BBF148230EA1', { aps => { alert => "Hello, APNs!", badge => 1, sound => "default", }, foo => [qw/bar baz/], }
);
if ( my $error = $apns->retrieve_error ) { warn 'err:' . Dumper $error; }
always return $VAR1 = { 'command' => 8, 'status' => 8, 'identifier' => 0 };
by with same token Net::APNS work - sucessuly send!