How to test production push notifications?
Asked Answered
R

5

48

Until now I used development push certificate and the push notifications worked great.

Now I want to submit my app to Apple so I created a production certificate and set it under "code signing identity" -> "Release"

I also placed the .p12 file in my production server.
But the push now does not work.

Is it suppose to work when I run from xcode? or will it just work when downloading the app from App Store? If so how can I test it?

Reagan answered 16/9, 2012 at 12:55 Comment(2)
possible duplicate of iPhone: Push Notification Testing on Production CertificateGarrotte
Use TestFlight to share your app and follow this answer---> https://mcmap.net/q/257597/-why-push-notifications-is-not-working-on-testflightLumpkin
H
35

The production push will work when you download the app from the App Store.

UPDATE:
You can also test the production push with an AdHoc build of the app; see Trinca's answer.

UPDATE:
Now, the easiest solution is to use Apple's TestFlight. (In TestFlight, it is easy to add new remote users, sending them an email invitation, they then download on whatever device they choose.)

Headgear answered 16/9, 2012 at 13:0 Comment(5)
No. you can test it with the dev push certificate.Headgear
It's wrong. You can test the APNS production environment with AdHoc distribution. Answer below.Picador
It seems that this has finally changed with iOS 10 - I just stumped into this. Even with adhoc and/or testflight (distribution certificate builds), the apps only receive dev pushes, and never production certificate pushes. Production pushes might basically only work with apps downloaded from app store? I'll look for some info on this.Beverleebeverley
@Jonny, No, it didn't change. As of iOS 10 DEBUG builds gets Sandbox APNS and RELEASE builds (either app store, testflight or ad-hoc) get production APNS. Check your setup because there should be an error around.Nalepka
Ok not sure what happened but you are right if by release you mean distribution certificate builds.Beverleebeverley
P
51

You can test APNS production environment building an AdHoc version of your App. The app will be using the production certificates and servers and it's purpose is exactly to test BEFORE you send it to AppleStore.

Take a looke at this link: what kind of certificate do I need to test apns using ad-hoc distribution?

Picador answered 20/12, 2012 at 15:15 Comment(1)
To be clear, you don't build an Ad Hoc version of your app. You build a release version of your app, and you distribute an Ad Hoc version. It is the distribution that changes the entitlement aps-environment to production.Punctual
H
35

The production push will work when you download the app from the App Store.

UPDATE:
You can also test the production push with an AdHoc build of the app; see Trinca's answer.

UPDATE:
Now, the easiest solution is to use Apple's TestFlight. (In TestFlight, it is easy to add new remote users, sending them an email invitation, they then download on whatever device they choose.)

Headgear answered 16/9, 2012 at 13:0 Comment(5)
No. you can test it with the dev push certificate.Headgear
It's wrong. You can test the APNS production environment with AdHoc distribution. Answer below.Picador
It seems that this has finally changed with iOS 10 - I just stumped into this. Even with adhoc and/or testflight (distribution certificate builds), the apps only receive dev pushes, and never production certificate pushes. Production pushes might basically only work with apps downloaded from app store? I'll look for some info on this.Beverleebeverley
@Jonny, No, it didn't change. As of iOS 10 DEBUG builds gets Sandbox APNS and RELEASE builds (either app store, testflight or ad-hoc) get production APNS. Check your setup because there should be an error around.Nalepka
Ok not sure what happened but you are right if by release you mean distribution certificate builds.Beverleebeverley
C
13

Create an Adhoc distribution profile for your app in provisioning profile. Download profile and install. Choose the Adhoc dist profile to code sign your app. Archive ipa and save for adhoc distribution. Copy ipa to your device and test push. It will use production push certs as opposed to development cert. Hope this helps.

Cetinje answered 11/3, 2013 at 22:0 Comment(2)
do we need any code change in php code while testing in development and production?Horehound
You need to change the Apple URL to point to the non-sandbox URL... ssl://gateway.sandbox.push.apple.com:2195 to ssl://gateway.push.apple.com:2195Dare
C
2

Testing production notifications (without releasing the build) is possible when the app is installed via Apple TestFlight.

This way the production notifications will be delivered to the app.

(If the exactly same build is installed via HockeyApp or by other means, the production notifications won't be delivered.)

Just set the build to internal testing after the build has finished processing in iTunes Connect.

Caputo answered 2/11, 2016 at 8:2 Comment(0)
A
1

If you want to test Push Notification on production environment, you need to take care of few things:-

  1. Production push notifications can only be tested on ipa. You need to create ipa from AdHoc Distribution profile.
  2. You need to replace the Push certificate on your Push API server. APNS Distribution certificate is to be used in this case.
  3. If your API is in DOTNET then you need to change the boolean value to true.
  4. Change Code Signing Identity to distribution on both Projects and Targets
Aureaaureate answered 11/8, 2016 at 7:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.