Archive for May, 2010
I recently discovered, that push notifications containing the word “(null)” (without the quotes) do not get pushed. They don’t break your APNS connection, simply never reach the recipient’s device.
Most likely, Apple wants to avoid some injection and I’m pretty sure, there are more words out there, that will not push.
In PHP, you can take simple precautions, to work around this:
$message = "(null) bla bla bla bla bla"; //this is our message
$messageFiltered = str_replace("(null)", "", $message);
I discovered this, when trying to push an iCal calendar event. Sometimes, iCal does not add the sender’s name, but (null) instead.
Hope, this is helpful to someone out there.
In case, you know more “forbidden words”, please leave a comment.
When implementing a push notification feature into your application, you usually create two different types of certificates: One for development (sandbox) and one for your customers/testers (production).
As you might already know, your device will automatically run in sandbox mode when launching the app directly from XCode.
So, the following method inside your app delegate will receive a device token, which is different than the one it receives, when you install it via iTunes:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken;
You have to keep in mind, that your push messages will not get delivered on this device, if you’re not running the development (sandbox) certificate on your server. Another important thing is the fact, that in case your server is running the production certificate and you try to send a push message to a device in sandbox mode, it will break connection to APNS. This means, that even push messages using the correct certificate will not get delivered any longer, until you reset connection to APNS.
So, if you sometimes wonder why push notifications fail during development of your app, consider the above.
