Android – Cordova app that doesn’t use push notifications: “Missing push notification entitlement”

androidcordovaios

We've got a Cordova based iOS app that does not use push notifications. As of Cordova 3.5.0, each submission we have made to the app store results in an email informing us that our app includes API used to register with Apple's Push Notification Service, but doesn't have push notification entitlement.

The app has been accepted each time, as we don't actually use push notifications for anything. However, I would like to avoid triggering this warning in case Apple decides to change their policy as to whether these API references are acceptable.

We did not experience the issue with prior versions of Cordova, and have done no work in Objective-C ourselves. Is this a known issue with Cordova 3.5? Searching has yielded some folks with similar problems but I've only found solutions for people wanting to add push entitlements, (rather than figure out where the Push API is being referenced and remove it). I took a look at the Cordova issues ML, but didn't find anything there. Any other leads that folks are aware of would be appreciated!

Plugins used:
org.apache.cordova.console
org.apache.cordova.device
org.apache.cordova.file
org.apache.cordova.inappbrowser
org.apache.cordova.media
org.apache.cordova.network-information
org.apache.cordova.splashscreen

Relevant email snippet, specific info replaced with [ ]:

From: iTunes Store
Date: Wed, Sep 17, 2014 at 3:49 PM
Subject: iTunes Connect: Your app "[appName]" (Apple ID: [id]) has one or more issues
To: [developer]

Dear developer,

We have discovered one or more issues with your recent delivery for "[app]". Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Missing Push Notification Entitlement – Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

Regards,

The App Store team

Best Answer

HOW TO DO THIS VIA THE XCODE UI (6.1):

While commenting out the offending code in Classes\AppDelegate.m will get your app approved, you want to continue benefitting from future Cordova upgrades so the best way to do this is to turn on the DISABLE_PUSH_NOTIFICATIONS symbol during compilation so this bit of code gets left out.

I come from a C# background so I understand conditional compilation but I am new to XCode so I had to do a bit of research finding out how to define compilation symbols via the UI.

Turns out the magic words are 'Preprocessor Macro'. This is how the you can accomplish this graphically (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.