I have a production iOS App that I can send development push notifications (APNs) no problem from my production API environment. The issue is when I archive the app and publish to the App Store the push notifications never work from the App downloaded from Itunes from my production API environment.
"When using Xcode to submit an app, Xcode will re-sign it using the
code signing identity and associated provisioning profile you select.
So the signature of the submitted app and its contents might be
different than what's in the Xcode archive."
Here's how to check the signature for an iOS app being submitted to
the App Store:
codesign -d --entitlements :- "Payload/YourApp.app"
Save for iOS App Store Deployment
Sign and Package application for distribution in the iOS App Store
The main reason production pushes don't work while dev ones do is you have broken the
"Push Rule of Three".
There are two sets of triplets:
a) Prod app - Prod gateway - Prod certificate b) Dev app - Dev gateway - Dev certificate
You can't mix and match these together, if you have any combination that isn't either 3 Production things or 3 Dev things then the push won't work. This is the "Push Rule of Three".
Prod App/Dev App
When you build/run via Xcode its a Dev app. When you create an archive and make an ad-hoc distribution or publish to the app store its a Prod app.
Prod Gateway / Dev Gateway
This is the prod gateway:
And this is the dev gateway:
Prod cert / Dev cert
You need to use the Apple provisioning portal to generate a Dev cert and a Prod cert and sign your server with as appropriate (you can combine both the prod cert and prod key and dev cert and dev key into a single .pem file which makes it convenient to sign the server with both).
One other thing to bear in mind is that when creating the archive, in the Xcode code signing section, the provisioning profile must be set to a properly created distribution profile.
I think the best tutorial on Pushes is Ray Wenderlich's.
This goes over the profile and the certificates and gets you to a position where something is working, however one huge omission of this tutorial is that it does not mention the Rule Of Three
In your situation, if you can send a push from your server to an Xcode build as indicated in your comments then it means two things:
1) You are using Apple's dev gateway. You MUST change that gateway to be able to send a push to a production build.
2) Your server has been signed with the development certificate. Your server MUST also be signed with the production certificate.
So you must have broken the rule of three, fix that and see if things work.