Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8 APS Environment Entitlement won't set to production

I have push notifications working on my app.
I went to go submit a new app update and I ran into an error with APS environment not being set.
I hit fix issue and it created the entitlement file with APS environment set to development.

To submit the app I obviously want this set to production. I change the value to production and proceed to archive the app for submission.
It throws an error in the capabilities section for push notifications with the last past "Add the Push Notifications entitlement to your entitlements file" being red.

So when I hit fix issue, it then changes the value of APS environment to development.
I came across a suggestion to inspect the provisioning profile and look for the APS environment property.
I went through the process of archiving and selected "Upload to App Store".

When I finally reached the summary, I clicked on the provisioning profile attached to the binary and entitlements.
I open the provisioning profile in a text editor and looked for the APS environment property.
I did find the property and it is set to production in the provision profile.
I decided to try another suggestion, which was to recreate the distribution provisioning profile.
I did make a new one and that solution doesn't work either.

From what I understand, the APS environment property is based on the value in your provisioning profile.

Any help would be appreciated. Thanks.

like image 422
user2337981 Avatar asked Sep 21 '16 19:09

user2337981


People also ask

What is APS environment entitlement?

The APS Environment entitlement tells your app whether to use the sandbox or production APNs environment, which are completely separate.

What is entitlements file in Xcode?

An app stores its entitlements as key-value pairs embedded in the code signature of its binary executable. You configure entitlements for your app by declaring capabilities for a target in Xcode. Xcode records capabilities that you add in a property list file with the . entitlements extension.


2 Answers

Turn off the "push notifications" in Capabilities then re-build.

Update

After hours of debugging, no matter how you configure Xcode8 or build with whatever scheme(debug or production), you will always get a deviceToken for development environment from APNS. I tried to remove my app on my test device which build directly from Xcode8.1 with production scheme. Then I installed my app from AppStore, which was archived from Xcode8.1 with same configuration two weeks ago, the AppStore version's notification service works fine, which proves that Xcode did set the right entitlement value for production environment. So, the solution is: leave the entitlements file alone, and keep "Push Notifications" switch on in Capabilities, do any fixes Xcode asked for. Hope this would help you.

like image 134
yuchen Avatar answered Oct 14 '22 05:10

yuchen


For me XCode 8 'Automatically manage signing' feature do it automatically & correctly when archiving according to provisioning profile we select for deployment method.

like image 7
Mayank Kumar Avatar answered Oct 14 '22 05:10

Mayank Kumar