IOS Missing Push Notification Entitlement

Hi, i can successfully build my project using xcode workspace, can make an archive and upload to app store but recently i received nice warning from Apple:

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 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. Xcode 8 does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor’s Capabilities pane, or manually add the entitlement to your entitlements file. For more information, see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/HandlingRemoteNotifications.html#//apple_ref/doc/uid/TP40008194-CH6-SW1.

The consequence is push notifications work on devices with ios11 but not with ios10. i spent all day on checking various options on xcode and found nothing to help me resolve that issue.
ps. I use phonegap-plugin-push 2.1.0 “PushPlugin”

 ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:
    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : ios 4.5.3
    Ionic Framework    : ionic-angular 3.9.2

System:
    ios-deploy : 1.9.2 
    ios-sim    : 5.0.13 
    Node       : v6.10.0
    npm        : 3.10.10 
    OS         : macOS High Sierra
    Xcode      : Xcode 9.2 Build version 9C40b 

1 Like

Unrelated. but I suggest you update your Node to the LTS. Your current version has multiple known security holes.

Yeah, i am going to update soon, the latest LTS is 8.9.4 so my 6.10.0 must be a bit ancient, Thanks!

I have regenerated provisioning profiles and still get that warning. It’s strange because profile does include '“aps-environment” entitlement:

aps-environment

Maybe a dumb question, but did you go into XCode capabilities tab and enable the Notifications toggle switch?

yep, i had enabled that

45

I can’t really answer your question because even if I use the same version of the plugin I don’t face this problem. What I would suggest is removing/adding the platform again. Long long time ago I remember I add a problem after updating a version of the push plugin I solved doing so.

Otherwise maybe one of the following threads will helps you find something:

https://github.com/phonegap/phonegap-plugin-push/issues/1408 (specially the last comment about a hook)

and on stackoverflow https://stackoverflow.com/questions/14807129/missing-push-notification-entitlement

P.S.: I also have to add, I don’t use pro to ship my app. I open the Myapp.xcworkspace project in Xcode, build/archive the app and upload it with application loader.

So do I, that is the fastest way to build the app with phonegap-plugin-push, thanks for the links you provided, i had read both. The apple warning i got just after adding cordova-universal-links-plugin to the project. I had to regenerate provisioning profile with enabled Associated Domains and it was beginning of my problems with push notify. So now i can get push notifications on my dev devices (i.e. with development provisioning profile) but when i upload the archive to TestFligh, testers can’t get push notify at all

ps. before adding universal-links-plugin push notify worked both in dev and production mode

When i validate the archive before export, i can’t see aps-environment on Entitlements list, but probably should be. The question is how to do it?

aps-environment

Finally i got rid of that apple warning (after 2 days digging in xcode).
So in theapp.xcworkspace i had to set ‘Automatically manage signing’, here is a nice tip: https://stackoverflow.com/questions/37806538/code-signing-is-required-for-product-type-application-in-sdk-ios-10-0-stic.
The second thing is manually setting ‘aps-environment’: in the file app_name.entitlements located in Resources folder add ‘APS Environment’ key to ‘production’ value.
Next: build, archive and when you use validate before export, on Entitlement list you can see ‘aps-environment’ set to ‘production’.

Will see tomorrow if push notify issue is fixed

4 Likes

Thanks for sharing. Apple’s rabbit holes are deadly. Any useful info is a public service.

1 Like

Congrats!!! And thx for documenting your solution

I’m having the same problem. Push Notifications are enabled for the App ID, in the provisioning profile and in the Capabilities.

Adding the aps-environment key manually to the generated *.entitlements file under Resources shouldn’t be the solution, since this file gets deleted if for some reason you need to remove the platform and it back again. If you forget to add again the key manually you end up with the same problem. What in your and my case is different to other environments that forces us to do this manual step? Why do others not have this problem?