Why do I get 400 BadDeviceToken on API pushes?
Technically there are two reasons why you would get a BadDeviceToken error message:
- The token is invalid.
- The device token does not match the environment of the sending certificate.
When users encounter this issue in Swrve, it is nearly always the second situation. Why? We must first start with understanding the different types of APNS environment:
What are the APNS environments?
Apple push services have two different types of environment.
The environment is an entitlement of the app, determined by the provisioning profile included in the build. In order for Push Notifications to send as expected, the environment must match the type of certificate used to send the push notification.
How does this affect Swrve pushes?
Each app in Swrve can upload one certificate for sending Apple pushes. The type of certificate can be checked on the Integration Settings page (Settings Tab -> Integration Settings).
A very important note here is that Development push certificates can only send push notifications to debug builds on devices. If the build was not built directly from XCode to the device, then it is likely that you will need a Production certificate in the Swrve dashboard in order to receive pushes.