Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Push Notifications work for Dev but not Enterprise Distribution

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

like image 503
addzo Avatar asked Apr 05 '13 21:04

addzo


People also ask

Why push notification is not working for iOS?

You can fix an iPhone that's not getting notifications by restarting it or making sure notifications are turned on. You should also make sure your iPhone is connected to the internet so apps can receive notifications. If all else fails, you should try resetting the iPhone — just make sure to back it up first.

How does push notifications work on the iOS platform?

An iOS push notification is a message that pops up on an Apple device such as an iPhone. Before receiving push notifications from an app, iOS device users must explicitly give permission. Once a user opts-in, mobile app publishers can send push notifications to the users' mobile devices.

Why do push notifications fail?

Some Android device manufacturers restrict or stop background processes that limit device connectivity with GCM, impacting push notification delivery on the device. This is particularly true for Chinese OEMs that tweak the Android OS to optimize battery life.

Do I need a server for push notifications?

Before you can get push notifications working, you need to set up your server and client with authentication keys. See Sign your web push protocol requests to learn why.


1 Answers

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.

like image 96
Dancreek Avatar answered Oct 17 '22 23:10

Dancreek