iOS development/production push certificates: when and how?

apple-push-notifications, ios, push-notification

Solution

1) The push notifications is handled by the App ID. So you can use that App ID either in a production environment and a testing one (development) (Ref).

2) I would say based on the certificate you created (development or distribution)

3) TestFlight uses a distribution profile if I am not mistaken. From their site:

In the Code Signing Identity drop down, select the same Distribution Provisioning Profile specified in the Release configuration from step 5 of the “Creating the Basic Application” section, and click Next. NOTE: When generating an IPA for distribution on TestFlight, you should always use an Ad Hoc Distribution Provisioning Profile for both the Archive and Distribute options. (Ref)

4) It's a distribution profile with the Ad-hoc option on (and not the Apple store one). With the distribution profile for the Ad-Hoc you can then specify which devices are eligible to be used (Ref)

Problem

The documentation is very obscure about this so I couldn't find a real answer to these questions: - In which exact cases should I use development certificate instead of production to send push notifications? - How does apple detect that the app is in "development" mode? Is this something hard-coded during the compilation according to the build configuration? - What if I create a totally custom build configuration -- let's say "TestFlight" -- which certificate should I use? - Is it possible to use the development certificate with an adhoc release (inside a circle of beta-testers)?

Original source