App rejected because of "Missing Push Notification Entitlement"

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?


Solution 1:

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.

Solution 2:

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

Solution 3:

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 ;-)

Solution 4:

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.

Solution 5:

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