Jorn van Dijk
Jorn van Dijk

Reputation: 1993

APN returning production push token instead of sandbox

When starting my app and registering for remote notifications via

[[UIApplication sharedApplication] registerForRemoteNotifications];

I get a sandbox push token, which is to be expected when running the app in development mode. When I press the home button and open the app again, this method is triggered again, but the device token returned from

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

suddenly became a production push token.

I can reproduce this every time. And to be clear, this happens in while the app is running. Is this an APN bug from Apple, or is there a way to check if the token is a sandbox token at runtime?

Upvotes: 0

Views: 914

Answers (1)

user3777906
user3777906

Reputation: 17

I know this is sort of old but ran into something similar where the device was not registering to the sandbox. We could push to it using the deployment profile no problem.

After a bunch of searching and looking, the Push Notification on our App IDs were disabled and had to turn them back on. We did not turn them off.
https://developer.apple.com/account/ios/certificate Indentifiers/AppIds choose your app and its the Push Notifications

After that download the updated profiles through XCode\Preferences\Accounts Then make sure its on in the app. Click on your app in Xcode to bring up the project. Then choose it again in Targets. Choose Capabilities from the Top and make sure the Push Notification is on. Double check the Code Signing in the Build Setting as well. That fixed it for us. Good luck.

Upvotes: 2

Related Questions