If you're encountering a 'Bad Device Token' error when sending push notifications to your iOS application, and your device subsequently shows 'Push Alerts Enabled: false', this usually indicates a mismatch between the Apple Push Notification service (APNS) environment configured in your Pushwoosh settings and the environment your application was built for.
Apple uses two distinct environments for push notifications:
* Sandbox/Development: For testing and development builds.
* Production: For apps distributed via the App Store or Ad Hoc/Enterprise distribution.
A device token generated for the Sandbox environment will be rejected by the Production APNS, and vice-versa, leading to a 'Bad Device Token' error. When APNS rejects a token, the system may mark the device as no longer reachable for pushes, changing its status to 'Push Alerts Enabled: false'.
To resolve this issue, ensure consistency:
-
Check your Pushwoosh Application Configuration:
- Navigate to your application's settings in the Pushwoosh control panel.
- Go to the iOS platform configuration section.
- Verify which gateway is selected (e.g.,
Gateway: Production
orGateway: Sandbox
).
-
Verify your iOS Application Build:
- Confirm the provisioning profile and build settings used for your application.
- Development builds (typically run directly from Xcode onto a device) should use the Sandbox APNS environment and a development certificate.
- Production builds (TestFlight, Ad Hoc, App Store) should use the Production APNS environment and a production certificate.
- Confirm the provisioning profile and build settings used for your application.
-
Ensure Alignment:
- If your Pushwoosh application is set to
Gateway: Production
, your iOS app must be built with a production provisioning profile. - If your Pushwoosh application is set to
Gateway: Sandbox
, your iOS app must be built with a development provisioning profile.
- If your Pushwoosh application is set to
By ensuring that both your Pushwoosh configuration and your iOS app build are targeting the same APNS environment, you should resolve the 'Bad Device Token' error and prevent the 'Push Alerts Enabled' status from being incorrectly set to false.
For more detailed information, you can refer to common troubleshooting steps for 'Invalid Token / Bad Device Token' errors in iOS push notifications within our help documentation.
Comments
0 comments
Please sign in to leave a comment.