Cordova app that doesn't use push notifications: "Missing push notification entitlement"
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):
Hope this helps other people out there in same situation.
Krik is right ! I've found this API calls in /Classes/AppDelegate.m
certainly generated by Cordova 3.5.
I din't tried it for the moment, but these lines can certainly be commented in xCode to avoid Apple's warnings.
- (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];
}
Have you had the Push Plugin installed at some point? Sounds like you have the respective Code somewhere in your application package. I'd do a project-wide search for the specific API calls e.g:
- didRegisterForRemoteNotificationsWithDeviceToken
- didFailToRegisterForRemoteNotificationsWithError
The dead code, files need to be removed.
Heres' the full documentation: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2
As Charles Merriam points out, newer versions of cordova-ios make it easy to disable touching push notifications by setting the preprocesor flag DISABLE_PUSH_NOTIFICATIONS. (See bug history.)
You will need to cordova platform update ios
, platform uninstall ios
and platform install ios
to get the new in AppDelegate.m. (Maybe there's a better way than blowing away the folder?)
I found a Cordova on_platform_add hook script that will edit project.pbxproj with that flag for you when you install the iOS platform. I needed to npm install xcode
to get the hook script to work.