Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: mark [...] aufflick.com
Cc:
AdminCc:

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



CC: bug-Net-APNS-Persistent [...] rt.cpan.org
Subject: Re: Net-APNS-Persistent: Not working in iOS 5 (invalid message format)
Date: Tue, 2 Aug 2011 17:17:21 +1000
To: Windfinder Support <info [...] windfinder.com>
From: Mark Aufflick <mark [...] aufflick.com>
Fantastic - thanks. I hadn't noticed I was generating the null body. Odd that the APNS server accepts it, but iOS 5 devices reject it. In any case I'll fix it and take a look at the loc-args conversion. I have to admit I don't ever send localised messages! Cheers, Mark. -- Mark Aufflick http://mark.aufflick.com/about/contact On Mon, Aug 1, 2011 at 8:35 PM, Windfinder Support <info@windfinder.com>wrote: Show quoted text
> 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 >