5

In development everything works fine:

  • my app (built with Phonegap) sends the device token to the server
  • my server sends the notification to the Apple servers
  • I receive the notification on my iPhone

But, when I switched to production (enabled push notifications and created a new SSL certificate for production) I keep getting "(8) Invalid token" from Rapns (which is installed on my push notification server).

I have read that this message is probably caused because I use a development device token in production (i.e. my server use a production certificate, but the app is running in development and sends a development device token to the server).

How can I run the app in production mode, so that I get a valid device token for production?

I think I should use an Ad Hoc Distribution Provisioning profile, but even if I have changed the "Code Signing Identity" properly in Build settings, I still get the same token I was getting in development! And this obviously doesn't work.

collimarco
  • 34,231
  • 36
  • 108
  • 142

2 Answers2

5

Solved by creating an archive - instead of run - and signing it with an Ad Hoc Distribution Provisioning profile.

collimarco
  • 34,231
  • 36
  • 108
  • 142
0

You may have to delete the already installed application on the device - do a xcode clean up(for a safer side) - reinstall the application.

thatzprem
  • 4,697
  • 1
  • 33
  • 41