Push notifications don't work in Apple Beta Te

2019-05-10 01:44发布

问题:

Push notifications worked fine with a Development provisioning profile, but once I tried putting the app on the Beta testing programme (TestFlight), they don't.

I tried following all the required steps when switching to a Production profile, but it still doesn't work. Here's what I have.

In the Member Center:

  • Certificate of type iOS Distribution.
  • App ID. Named (not wildcard). Push notifications enabled for both Development and Distribution - green lights - with all SSL certificates generated and uploaded.
  • iOS Distribution Provisioning Profile, that uses the above mentioned Certificate and App ID as well as lists Push Notifications among enabled services.

In XCode. Target > Build Settings > Code Signing:

  • Provisioning profile - iOS Distribution, same as in Member Center.
  • Code signing identity (both Debug and Release) - iPhone Distribution.

Am I missing something (not so) obvious? Any help would be greatly appreciated.

回答1:

Everything seems correct. Maybe you should precise what is not working :

  • App not registering to APNS token at all
  • App correctly registering but push not received

Process to the following checks

App not registering to APNS token at all

Mobile Provision

Make sure you refresh your mobileprovisions through XCode after enabling push to be sure those includes the correct entitlements. You can check this by opening the mobile provision in an editor and look for the aps-environment key?

Registration to APNS

make sure the code to register to APNS does not depend on any personal settings (like a Push Id for some SaaS push service that is missing)

.

App correctly registering but push not received

  • Check that the pushToken received is sent to the correct environment of your server (the one that connect to APNS)
  • Check that your server is using the Production APNS Certificate


回答2:

As it happens, I failed to provide full context in my question. I use Parse.com to handle my backend as well as push notifications. So what I was missing was a production certificate on Parse.com, not just a development one. So, if anyone else is using Parse and ran into a similar problem, I hope this is helpful.