xaicron / p5-Net-APNs-Extended

Client library for APNs
Other
2 stars 6 forks source link

always return status = 8 #5

Open luckydevil13 opened 9 years ago

luckydevil13 commented 9 years ago

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!

perlDreamer commented 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.

xaicron commented 9 years ago

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'
dinesh-it commented 9 years ago

Why can't you handle this in module itself? Is there any specific reason behind this?