Xcode 8: aps-environment is missing from the archived app

674 Views Asked by At

I recently updated to Xcode 8. During development I was failing to obtain a device token. Investigation showed that I needed to enable Push Notification under "Target -> Capabilities". Once I did that I was able to register and receive notifications just fine during development.

I am now ready to push the app to the app store. I created the archive and uploaded it to iTunes connect but got an email stating:

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.

I went back to the archive and I couldn't find the aps-environment in the list of entitlements. It then makes sense why I received the email. I have been trying now for several hours to get the archive (production) build to include the aps-environment entitlement but I have not been able to.

  • My AppID has Push Notifications enabled for development and production
  • Push notifications still remain enabled in Target -> Capabilities. The entitlement file that is generated has the environment as development. I have however read that during the archiving/uploading to iTunes the environment is automatically changed to production. I have stubbornly changed it manually to production but that made no difference.
    • I decided to use TestFlight to test the build that was uploaded and I confirm that notifications are not working.

My app worked well when built with Xcode 7. It is the upgrade to Xcode that has broken this and I have not been able to get over this hump. Any help will be greatly appreciated.

Below is exactly my issue but I don't have enough reputation points to add comments to revive the discussion so I'm posting a new question. I wouldn't mind if this is marked as a duplicate provided I can get a solution. Xcode 8 Says Provisioning Profile Has aps-environment entitlement but after export Archive aps-environment is missing

2

There are 2 best solutions below

0
On

Check that the file platforms/ios/APP_NAME/Entitlemens-Release.plist is the same as platforms/ios/APP_NAME/Entitlemens-Debug.plist

the parameter aps-environment have to apear in both: in your platforms/ios/APP_NAME/Entitlemens-Release.plist it had to be production

and in platforms/ios/APP_NAME/Entitlemens-Debug.plist - development

0
On

Try enabling Push Notifications in the target's capabilities tab.

That solved it for me.