36
votes

Recently my application got rejected while uploading it. The Apple review team says my app is "Missing Push Notification Entitlements"

This is the information they have provided:

Missing Push Notification Entitlement - Your app registers with the Apple Push Notification Service, but the application signature's entitlements do not include the required "aps-environment" entitlement. Make sure you have enabled Push Notification Services for this app, and that you have downloaded a Distribution provisioning profile that includes the "aps-environment" entitlement.

Earlier versions of my app used to have push notifications, and my app binary never got rejected due to that. What should I do here?

10

10 Answers

19
votes

Open your Provisioning Profile in any Text Editor and search for "environment".

You should find: aps-environment

If you don't see aps-environment in your provisioning profile, there is an issue in your Apple provisioning certificate.

If you created a certificate without push notifications, and then later on you added Push Notification service, Apple DOESN'T update your provisioning profile.

You need to create a NEW provisioning profile. Sign the binary with this new Provisioning Profile and you would be good to go.

14
votes

I have recreated my Distribution provisioning profile and build my application with it. This change fixed the issue of Missing Push Notification Entitlements.

13
votes

If you are submitting a Cordova / Phonegap project and you are NOT using push notifications, you should inspect Classes/AppDelegate.m for the two methods below. Observed in Cordova 3.7.0, not sure about other versions.

Make sure you are not using remote notifications in any other way (carefully check your plugins as well). Then remove or comment out the following block:

- (void) application:(UIApplication*)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    // re-post ( broadcast )
    NSString* token = [[[[deviceToken description]
        stringByReplacingOccurrencesOfString:@"<" withString:@""]
        stringByReplacingOccurrencesOfString:@">" withString:@""]
        stringByReplacingOccurrencesOfString:@" " withString:@""];

    [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
}

- (void) application:(UIApplication*)application
    didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    // re-post ( broadcast )
    [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
}

Hope this saves you a few hours ;-)

8
votes

I had the same problem and I fixed it by recreating the provisioning profile. From "Provisioning and Development" in the Local and Push Notification Guide:

The Team Admin or Team Agent must next create the provisioning profile (Development or Distribution) used in the server side of remote-notification development. The provisioning profile is a collection of assets that associates developers of an application and their devices with an authorized development team and enables those devices to be used for testing. The profile contains certificates, device identifiers, the application’s bundle ID, and all entitlements, including . All team members must install the provisioning profile on the devices on which they will run and test application code.

4
votes

My Case : I have implemented push notifications for an update to my appstore app. As the provisioning profiles prior to the push notification impelmentation becomes invalid, I have created new Appstore-distribution provisioning profile and built the app with new profile and uploaded to store. But I got a mail saying "Missing Push Notification Entitlement".

Finding : I found that while archiving, Xcode is using the wrong (invalid/old) provisioning profile. So deleted the old provisioning profile from member centre and it solved the problem

Screenshot while validating the archive

3
votes

I received this same error message, and recreating my provisioning profile didn't eliminate it.

Instead I found that my app contained some stray APNS-related symbols (in a library) that weren't being used. Apparently they caused a static analyzer to mark the app as using push notifications (it doesn't). #ifdef-ing out the symbols allowed my app to be accepted without the aps-environment entitlement.

3
votes

I also had this problem with a Cordova app and after doing a bit of reading it seems that this is a common issue nowadays.

WHY DID IT HAPPEN?

Since you mention that your app was already approved using push notifications, the most likely scenario is that the Provisioning Profile for your app was changed when submitting it to the AppStore. Perhaps you:

  1. rebuilt your project in XCode, or
  2. moved to another computer and forgot to tell XCode what the correct profile was, or
  3. somebody sat on your computer and changed it, or

This issue happens because permissions are gleaned through the provisioning profile. If you forget to link the provisioning profile for your app to an AppID that has the 'Push Notifications' entitlement (Note that XCode does this automatically by using the wildcard developer provisioning certificate by default) then you are likely to get this message until you sort out the permissioning.

HOW TO REMOVE THE NEED FOR PUSH NOTIFICATIONS IN CORDOVA APPS:

I was submitting a Cordova app when I got this message, and while the solution posted by @jlapoutre is enough to get your app approved, you want to continue benefiting from Cordova upgrades so the best thing is to take advantage of conditional compilation (ie triggering the #ifndef DISABLE_PUSH_NOTIFICATIONS directive which tells XCode to compile you app with this bit of code left out).

Conditional compilation is also known as 'Preprocessor Macros' in XCode-speak. This is how the you can accomplish this graphically via the UI (note that this the way its done in XCode 6.1):

enter image description here

Hope this helps other people out there in same situation.

1
votes

I recently encountered this issue after adding a Today Extension to an app with Push Services enabled. Finally realized that the Mobile Provisioning profile generated by Xcode for the Today Extension did not have Push Notifications Services enabled. Once I enabled Push Services for the Today Extension, the warning from Apple went away.

0
votes

Steps

  1. Enable Push Notification Service (Production Push SSL Certificate)

  2. Create/Recreate Distribution Provisioning Profile and build your application with updated Distribution Provisioning Profile.

The following resources may help you

0
votes

I have same problem. I have solved it.

I think this problem causes when adding push-notification-function into AppID and no recreating Provisioning. We will receive a warning when adding iCloud-function:

All new provisioning profiles you create for this App ID will be enabled for iCloud. If you wish to enable iCloud for any existing provisioning profiles associated with this App ID, you must manually regenerate them

I think when we add some function in AppID, we should manually regenerate all provisionings which are related to that AppID.

I think so