APN Device Tokens
When you enable Apple Push Notifications (APN) for your App, your device generates a unique device token and pass it to the didRegisterForRemoteNotificationsWithDeviceToken method in your App delegate. Usually, you’ll hand the token to your server in order for it to push notifications to your device.
There are different tokens for production and sandbox, depending on which provisioning profile you build/sign your App with. One more gotcha, you need to be aware of when it comes to those device tokens: don’t mix production and sandbox tokens!
If you try to send a push notification to the production servers, using a device token meant for the sandbox, Apple’s servers totally block all other notification, which you are trying to send with the same connection. If you have a scheduled push notification like we do with “I think I spider”, one wrong device token ruins the fun for everyone!
We decided to separate our production and test environment and use preprocessor conditional inclusion to point to different urls in our App. Unfortunately, we had to learn the hard way how tedious this gotcha can be to track down!