15

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:

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html

"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

addzo
  • 845
  • 3
  • 13
  • 37
  • Both the development and production versions of the AppID have push notifications enabled (on the Apple provisioning website)? – GoZoner Apr 06 '13 at 02:50
  • Ah! Excellent question! I should have stated that. No. I purposely never enabled the production profile. Development side is green, production side is still yellow in the portal. – addzo Apr 06 '13 at 10:43
  • 1
    Enterprise builds use the production/distribution certificate. You'll need to enable it and use it with your push service. – Dancreek Apr 06 '13 at 20:05

3 Answers3

15

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.

Dancreek
  • 9,524
  • 1
  • 31
  • 34
  • 1
    Yep! I did some tests and found that there is no way to make an enterprise build have an aps-environment value of anything other than production. It's weird to me that that would be true though. The purpose of an Enterprise build is to send it out to people BEFORE you go to production. But there it is. Now I just have to figure out why sending the builds out to people makes push notifications not work even if I distribute after building with my dev profile and not the enterprise profile. Maybe it knows somehow that it's not ad hoc. Thanks Dancreek! – addzo Apr 08 '13 at 00:13
  • 9
    The purpose of Enterprise is for production releases. Its intended to be used by companies for producing in-house tools. Its a private, alternative production route to the App Store. – Dancreek Apr 08 '13 at 16:11
  • K. That's also great info. Thanks again Dancreek! – addzo Apr 08 '13 at 20:58
  • Just wanted to point out that the helpful part here for me was "whatever push mechanism you are using to send pushes needs to be configured with the correct certificate". In my case I was using Parse.com, and I had not updated the .p12 certs on their side, only all the certs I was using when building the app. Thanks! – SmartyP Oct 30 '13 at 00:23
  • Today my developer account was migrated from individual to organization. The remote notifications stopped working, I checked in app delegate and they don't arrive. I used the ,p8 with firebase. Should I delete the previous certificates & provisioning profiles and create new ones or? – bibscy Oct 31 '18 at 17:33
2

Both the development and production versions of the AppID need to have push notifications enabled on the Apple 'provisioning profile' website.

GoZoner
  • 67,920
  • 20
  • 95
  • 145
  • I'm not sure I'm being clear. We are only running against the Sandbox at the moment. Why would production need to be enabled if we are not using the production profile? Our problem is that using the Enterprise distribution profile instead of the developer profile make push stop working. What am I missing? thanks – addzo Apr 06 '13 at 18:51
  • Well, it is easy enough to try. Just enable it, install the updated profile and see. The sandbox you use is not relevant. – GoZoner Apr 06 '13 at 20:11
  • At my side I have both profiles containing push-notification but it works only with developer profile an dont with distribution...what should I do now? – Preetam Jadakar Jul 12 '13 at 08:49
  • @GoZoner few hours ago my account was migrated to organization. Now notifications stopped working. Should I delete the previous provisioning profiles and distribution/development certificates and create new ones? – bibscy Oct 31 '18 at 17:34
  • I'm fallen out of date on this topic. Sorry. Good luck. – GoZoner Dec 08 '18 at 05:10
2
  1. Use the production certificates.
  2. Use production APN Host: gateway.push.apple.com instead of development APN: gateway.sandbox.push.apple.com
  3. Use production APN Feedback Host: feedback.push.apple.com.

For more check here

Community
  • 1
  • 1
Blerd
  • 56
  • 5