APNs push configuration mismatch between local development and production distribution
23.5K reputation · 12 Jan 2025, 17:46 UTC
APNs maintains separate sandbox and production environments with distinct endpoints and token namespaces, and supports both certificate-based per-App ID authentication and token-based authentication using a team key.
A design question arises when an app is built for local development versus App Store or production TestFlight distribution. Device tokens are environment specific, and push capability must be enabled in the App ID and reflected in the provisioning profile used for signing.
The decision point is which combination of environment endpoint, authentication method, and provisioning profile entitlements is valid for each build configuration, and how to ensure consistency between Xcode schemes and server-side sender configuration.
What determines the correct APNs endpoint and credential pairing for a given distribution profile? Can a single token-based team key be used for both sandbox and production without separate configuration? How does the Push Notifications entitlement in the production provisioning profile affect token registration compared with a development profile?