I have read many posts here and been through the Apple docs all day. None of the posts here have answers and the docs are unclear on this issue.
We have an app that is receiving push notifications when using the Dev profile but not when we use our Enterprise distribution profile.
The app ID is enabled for push notifications in sandbox.
The cert and both profiles are associated with the app id.
If I build form Xcode push notifications come in fine. If I archive and distribute the server returns:
[Failed to push 6dje7djksis7hyhdjshsjksjd74jdjskshdjd8dhjjdkwu for reason 8]
Which is Invalid Token.
One thing I noticed was that our dev provisioning profile has the following for aps-environment:
<key>aps-environment</key>
<string>development</string>
While the Enterprise distribution profile has:
<key>aps-environment</key>
<string>production</string>
When I run a debug build to my phone (push works) the .app file's entitlements are:
<key>aps-environment</key>
<string>development</string>
When I archive they are always (no matter what provisioning profile I use or scheme):
<key>aps-environment</key>
<string>production</string>
Can anyone tell me if this is expected? None of the other questions on this site that I have been able to find actually come up with a reason why Dev would work but Enterprise Distribution would not.
Why would archiving always make the aps-environment production?
Thanks for your time.
Update This is interesting.
From:
"You must get separate certificates for the sandbox (development) environment and the production environment. The certificates are associated with an identifier of the application that is the recipient of push notifications; this identifier includes the application’s bundle ID. When you create a provisioning profile for one of the environments, the requisite entitlements are automatically added to the profile, including the entitlement specific to push notifications, . The two provisioning profiles are called Development and Distribution. The Distribution provisioning profile is a requirement for submitting your application to the App Store."
This could mean that you don't use a distribution profile unless you are going to production. Is that true? That seems weird since you can make an enterprise distribution profile before going to the app store.
Anyone have an idea about that? I can't find any specific information in the docs about that.
Thanks
There are 2 push certificates for your app. 1 for development and 1 for production. Look in the push certificate section of the provisioning portal.
So whatever push mechanism you are using to send pushes needs to be configured with the correct certificate. In your case, the enterprise release will receive pushes using the production/distribution certificate.