Skip Menu |

This queue is for tickets about the Net-APNS-Persistent CPAN distribution.

Report information
The Basics
Id: 69933
Status: new
Priority: 0/
Queue: Net-APNS-Persistent

People
Owner: Nobody in particular
Requestors: info [...] windfinder.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: mark [...] aufflick.com
Subject: Net-APNS-Persistent: Not working in iOS 5 (invalid message format)
Date: Mon, 1 Aug 2011 12:35:16 +0200
To: bug-Net-APNS-Persistent [...] rt.cpan.org
From: Windfinder Support <info [...] windfinder.com>
Hi, we are using your module to send push notifications to our app users. Worked perfectly fine until some of our users have upgraded to iOS 5. After that push notifications have not arrived anymore (when app was closed). Environment: Net::APNS::Persistent 0.02 & 0.03 iOS 5 Beta 4 OS: Linux 2.6.32-5-amd64 Perl: v5.10.1 This is how you can reproduce that error. You have to send a localized notification (that means without a body element). $apns->queue_notification( $devicetoken_hex, { aps => { alert => { loc-key => 'MY_LOC_KEY', loc-args => ['arg1', 'arg2'] }, sound => 'default', badge => 1, }, }); Sent message: {"aps":{"alert":{"body":null,"loc-args":["arg1","arg2",1],"loc-key":"MY_LOC_KEY"},"badge":1,"sound":"default"} A body element with the value null was added to the final json payload of the push notification. This additional element (which is not allowed to be null) causes the error in iOS 5. The sent message won't be displayed like it has never arrived on the device. A possible could be look like this. At least it worked for us. Another potential problem could be that the utf8/conversion is not done for the loc-args strings. if (ref $payload->{aps}{alert} eq 'HASH') { if (exists $payload->{aps}{alert}{body}) { $payload->{aps}{alert}{body} = $func->($payload->{aps}{alert}{body}); } } else { $payload->{aps}{alert} = $func->($payload->{aps}{alert}); } Best regards Johannes Bönniger Windfinder Support Windfinder.com GmbH & Co. KG Knorrstr. 24 Hinterhaus 24106 Kiel GERMANY phone: +49 431 8008643 fax:  +49 431 8008644 cell: +49 177 4933362 Skype: windfinder.com www.windfinder.com Sitz: Kiel, Handelsregister: Kiel HRA 6742 KI VAT-Identification No.: DE268454511 Komplementärin: Windfinder.com Verwaltungsgesellschaft mbH Sitz: Kiel, Handelsregister: Kiel HRB 11064 KI Geschäftsführer: Oliver König, Jonas Kaufmann