I’ve been trying to debug push notifications, but they fail silently so it’s been difficult. As far as I can tell, I’ve correctly followed Apple’s instructions, so I was wondering if anyone else sees any issues with my setup:
It used to be working, using a development certificate and a Debug build of my app. When I created the AdHoc build to start testing with others, that’s when the problems started. I created a production certificate, which I’m using now on the server. I also changed the APNS destination from sandbox to production. I updated the provisioning profile (and <key>aps-environment</key><string>production</string> is present as required), and rebuilt and packaged the app as an IPA (using the new profile) which I distributed to my testers through TestFlight. I can tell that it was definitely packaged with the new provisioning profile, since I added a new tester at the same time, and TestFlight shows the new tester.
I got the testers’ new device tokens and sent them all a simple alert notification: {"aps":{"alert":"hello"}}, but no success. Any tips?
One thing I found weird: I thought device tokens were supposed to change when you have a new provisioning profile? But for all my testers it seemed that the device tokens were the same ones as before. I thought that maybe the provisioning profile wasn’t getting updated on their phones for some reason, so I asked one of them to delete the profile from his phone settings (by the way, there turned out to be two of them for the app, with the same name), and re-install the app using TestFlight. But, his device token actually still stayed the same. Any tips? Thanks in advance!
In case anyone else is having this problem, here’s the solution: It seems to be caching the device token, so try just creating a new app in the dev center for your AdHoc build.