If push tokens for your iOS users are missing from User Explorer or disappear after registering, push delivery fails. The usual cause is a mismatch between your app's build environment and the gateway setting in your Pushwoosh Control Panel.
Primary cause: APNs gateway mismatch
Apple uses two environments for the Apple Push Notification service (APNs):
- Sandbox: for development and testing. Used for builds installed directly from Xcode with a development provisioning profile.
- Production: for distribution. Used for builds distributed via TestFlight or the App Store, signed with an Ad Hoc, Enterprise, or App Store provisioning profile.
The Gateway setting of your Pushwoosh iOS configuration must match the provisioning profile type used to sign your build. If they don't match (for example, the app is a Sandbox build but Pushwoosh is set to Production), APNs rejects the token with BadDeviceToken and the device is unsubscribed in Pushwoosh.
How to fix the gateway mismatch
You have two options:
-
Change the gateway in Pushwoosh:
- Log in to the Pushwoosh Control Panel and open your project's iOS platform configuration.
- Set Gateway to Sandbox for development builds, or to Production for TestFlight and App Store builds.
-
Re-sign your app: to test in a production environment, sign the build with a production profile (for example, via TestFlight) and set the Pushwoosh Gateway to Production.
Other common causes of delivery problems
Incorrect user targeting: a User ID (a built-in Pushwoosh identifier) is not a Tag. If you filter a message by a tag named
userId, it does not target devices by their Pushwoosh User ID. Make sure your segment uses the right identifier.Handling user logout: avoid calling
unregisterDevicewhen a user logs out. It removes the push token and makes the device unreachable. Instead, callsetUserIdwith a default value for logged-out users, so the device stays registered and can receive pushes after the next login. See Collecting User IDs and managing user transitions.
Comments
0 comments
Please sign in to leave a comment.