[BUG] iOS Push Messages - custom data parsing

Hi,

i’ve implemented push messages using netmera.com according to this very usefull tutorial: http://forums.coronalabs.com/topic/35846-whos-using-what-for-push-notifications/page-2

On Android everything works fine, but on iOS the app “quit-crashes” as soon the push arrives with a custom data table. Without custom data it works (sending just the alert string)

It’s also not possible to push a badge number, it just doesn’t arrive.

This is the xcode console output on the device when it’s crashing. I’m using an iPhone3GS:

\<Error\>: -[\_\_NSCFString count]: unrecognized selector sent to instance 0x1c529a90 \<Error\>: \*\*\* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[\_\_NSCFString count]: unrecognized selector sent to instance 0x1c529a90' &nbsp;&nbsp; &nbsp;\*\*\* First throw call stack: (0x341ae2a3 0x3be0897f 0x341b1e07 0x341b0531 0x34107f68 0x70a77 0x90285 0x764a1 0x767d5 0x76de3 0x36016ad9 0x36016663 0x3600e84b 0x35fb6c39 0x35fb66cd 0x35fb611b 0x37c725a3 0x34183683 0x34182ee9 0x34181cb7 0x340f4ebd 0x340f4d49 0x3600d485 0x3600a301 0x43f7f 0x43f38)

Not sure if this is a netmera problem or not. But it seems there is a bug parsing the custom string…

Thanks and all the best.

What version of Corona SDK are you using?

Have you tried putting some prints in to see what launchArgs is or the event table?

Thanks

Rob

Hi Rob,

i’m still using version 2013.1202 (2013.8.28) because I use setReferencePoint quite a lot.

The strange thing is, that the app crashes even before the print gets fired, no matter if it cold starts or is already active.

Both times as soon as the push arrives the app crash-quits.

Thanks

You should be able to add this line:

graphicsCompatibility = 1

to your config.lua file at the same place you set your width and height and you can continue to setReferencePoint and all of the G1 style colors, etc.   Build 1202 won’t be able to be used to upload apps to Apple after Feb 1 since that build is based on the iOS6 SDK and they will start requiring iOS7 SDK apps then.   I don’t know if you’re using Facebook with our facebook.login() calls or not.  Facebook has breaking changes also around 2/1 that will require you to have a later build of Corona.

Even if your display won’t work, it would be worth while to at least try your push notifications against build 2100 or the latest daily build to see if the push behavior is fixed.

Rob

Thanks, for the information Rob! I’ve added the compatibility but some of my displayObjects have no width and height, so I need to fix that. Anyway, good to know about the iOS7 issue!

Unfortunately the push message bug isn’t gone, even with version 2014.2155 (2014.1.25) :frowning:

Is there any way to know what’s in the push packet?

Rob

I don’t know how I could do that on iOS, because the app crashes before it prints something.

On Android the print looks like this:

I/Corona  (27209): {“type”:“remote”,“name”:“notification”,“custom”:{“msg”:“testmsg”},“alert”:“test”,“applicationState”:“inactive”}

If I don’t send the custom data (so that the app doesn’t crash) it looks like this on iOS:

 {“type”:“remote”,“name”:“notification”,“custom”:[],“alert”:“test”,“applicationState”:“inactive”}

I’d go ahead and file a bug report on this.  Make sure to include your config.lua and build.settings as well as the output above.

Rob

Hi Rob,

I’ve just prepared a bug test project to submit.

I just want to mention, that it’s not that straight forward to test the issue, since the problem occurs only with remote pushes.

This means the testers need to create an iOS AppID with APNs enabled and the according certificates.

Then they need to register an app at netmera.com and submit the certificate to their service and update the netmera API key in the test project.

Just wanted to make sure if that’s ok, because the bug submission guidelines clearly state that the code “should not contain references to any 3rd party tools/code.” 

Thanks!

That’s why you need to include the table’s that you get.  We probably won’t be able to sign up with your service, but we have a way of testing push notifications and can probably control the data packet.

Rob

We’re having the same problem. Any solution yet?

What version of Corona SDK are you using?

Have you tried putting some prints in to see what launchArgs is or the event table?

Thanks

Rob

Hi Rob,

i’m still using version 2013.1202 (2013.8.28) because I use setReferencePoint quite a lot.

The strange thing is, that the app crashes even before the print gets fired, no matter if it cold starts or is already active.

Both times as soon as the push arrives the app crash-quits.

Thanks

You should be able to add this line:

graphicsCompatibility = 1

to your config.lua file at the same place you set your width and height and you can continue to setReferencePoint and all of the G1 style colors, etc.   Build 1202 won’t be able to be used to upload apps to Apple after Feb 1 since that build is based on the iOS6 SDK and they will start requiring iOS7 SDK apps then.   I don’t know if you’re using Facebook with our facebook.login() calls or not.  Facebook has breaking changes also around 2/1 that will require you to have a later build of Corona.

Even if your display won’t work, it would be worth while to at least try your push notifications against build 2100 or the latest daily build to see if the push behavior is fixed.

Rob

Thanks, for the information Rob! I’ve added the compatibility but some of my displayObjects have no width and height, so I need to fix that. Anyway, good to know about the iOS7 issue!

Unfortunately the push message bug isn’t gone, even with version 2014.2155 (2014.1.25) :frowning:

Is there any way to know what’s in the push packet?

Rob

I don’t know how I could do that on iOS, because the app crashes before it prints something.

On Android the print looks like this:

I/Corona  (27209): {“type”:“remote”,“name”:“notification”,“custom”:{“msg”:“testmsg”},“alert”:“test”,“applicationState”:“inactive”}

If I don’t send the custom data (so that the app doesn’t crash) it looks like this on iOS:

 {“type”:“remote”,“name”:“notification”,“custom”:[],“alert”:“test”,“applicationState”:“inactive”}

I’d go ahead and file a bug report on this.  Make sure to include your config.lua and build.settings as well as the output above.

Rob

Hi Rob,

I’ve just prepared a bug test project to submit.

I just want to mention, that it’s not that straight forward to test the issue, since the problem occurs only with remote pushes.

This means the testers need to create an iOS AppID with APNs enabled and the according certificates.

Then they need to register an app at netmera.com and submit the certificate to their service and update the netmera API key in the test project.

Just wanted to make sure if that’s ok, because the bug submission guidelines clearly state that the code “should not contain references to any 3rd party tools/code.” 

Thanks!

That’s why you need to include the table’s that you get.  We probably won’t be able to sign up with your service, but we have a way of testing push notifications and can probably control the data packet.

Rob