How do I make my debug app version receive production push notifications on iOS?
Asked Answered
M

4

21

My server is sporting only one version of sending push notifications, and it has my production (release) push certificate.

How do I test the notifications on my debug device and debug builds, using the same production certificate?

My device is sending the token, but when I attempt to send a real push notification Apple servers return status 8 error, that means that device token is incorrect.

Meta answered 30/6, 2014 at 13:52 Comment(0)
E
2

If you want to test your app in production mode, you will need distribute the Distribution version of your app using ad hoc.

When your application ready for submission, you create an ad hoc provisioning profile specifying an App ID that matches one or more of your apps, a set of test devices, and a single distribution certificate.

Here is an image to illustrate how the provision profile works:

enter image description here

Elene answered 30/6, 2014 at 13:58 Comment(0)
T
23

A little late to the party, but even when all the other answers are correct, they don't really answer your question.

The answer is: You cannot test production APNS with a debug build.

Debug builds will always get sandbox APNS tokens.

Release builds (ad-hoc or app store) will always get production APNS tokens.

The logic behind that is, in order to debug an app you need to sign with a debug certificate and provisioning profile. That provisioning profile determines what APNS endpoint your app connects to.

Tavern answered 8/9, 2017 at 13:54 Comment(2)
Release builds (ad-hoc or app store) will always get production is confusing. Debug and release builds in Xcode both use development APNs, I've tested this. Distribution via Ad Hoc or App Store is what changes the app entitlement to use production APNs. I wanted to highlight the difference between builds and distribution.Clubhouse
Do the apps released on testflight count towards Release Or Development?Haematosis
S
10

If you build your app with development provisioning profile, you'll receive a sandbox device token, which is valid only in the sandbox push environment (using the sandbox push server and sandbox push certificate).

If you build your app with production or AdHoc provisioning profile, you'll receive a production device token, which is valid only in the production push environment (using the production push server and production push certificate).

Sideslip answered 30/6, 2014 at 14:11 Comment(1)
In Pusher app, my production push certificate shows both options(Sandbox|Production), does it mean is there any way to debug push notifications on the ad-hoc build if I enable (Sandbox) option for production certificate? ibb.co/Mp4vc50Fescennine
E
2

If you want to test your app in production mode, you will need distribute the Distribution version of your app using ad hoc.

When your application ready for submission, you create an ad hoc provisioning profile specifying an App ID that matches one or more of your apps, a set of test devices, and a single distribution certificate.

Here is an image to illustrate how the provision profile works:

enter image description here

Elene answered 30/6, 2014 at 13:58 Comment(0)
T
0

Maybe the workaround is send both production and sandbox push notification together. I think it may help if you want to test internal (like use AdHoc build); However, I don't think it is reasonable to deploy such a strange way in your production environment.

Trimurti answered 2/10, 2018 at 10:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.