Xcode 8.1 "Provisioning profile doesn't include the aps-environment entitlement" - ios

Is anyone experiencing this problem?
After persistence problemas and information retrieval on the KeyChain I had enable
the KeyChain Sharing feature in Capabilities.
This was to create a file called .entitlements
So, when I gonna run the Archive this error occurs:
Check Dependencies:
Provisioning profile doesn't include the aps-environment entitlement.
Code signing is required for product type 'Application' in SDK 'iOS 10.1'
I'm using OS El Capitan 10.11.6, Xcode 8.1
If anyone can help.
Pleaseeee....

Check the Capabilities tab on your target and make sure the Add the Push Notifications entitlement to your entitlements file shows a check mark (under Push Notifications). If it shows an error, fix and you should be good to go.

For my case, Xcode 9
Case 1:
I used fastlane match before I added push notification capability and entitlement file.
Solution 1:
Run fastlane match again. It will detect that the provisioning profile is no longer valid since you added capabilities and will regenerate again, and push to your repo.
Case 2:
I used fastlane match before I added push notification capability and entitlement file.
I regenerated the invalid provisioning profile in the developer.apple.com account manually. So when I ran match, I got error
Provisioning profile '4d89b10f-568e-400d-a4e9-c96e0a51fd46' is not
available on the Developer Portal for the user a#xyz.com Make sure to
use the same user and team every time you run 'match' for this Git
repository. This might be caused by deleting the provisioning profile
on the Dev Portal
this may also happen when you press Fix Issue from Xcode
Solution 2:
Step1: delete the invalid provisioning profile from your certificates repo
Step2: run
fastlane match

It can happen that you have two entries for the "Apple Push Notifications Service" in your Entitlements file. This seems to be a bug in XCode (even in v8.2), which it cannot resolve by itself.
Open your Entitlements file in the text editor of your choice.
I had the following duplicate entries in my Entitlements file:
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
Try deleting one of the two key-value pairs. For me, deleting the first entry aps-environment solved the issue.

When you add push notifications to your app.
If you already have a provisioning profile.
It will become invalid.
You have to go to developer.apple.com
Edit your provisioning profile.
Then download the newly created one and double click on the same.
XCode will automatically replace the last one which became invalid.

Also verify that the apple id that you created on the Developer portal (developer.apple.com) has Push Notifications enabled. I faced it when I created the provisioning profile before enabling push notification on the app id so I had to edit the app id.

Target -> Capabilities
Make sure the Add the Push Notifications entitlement to your entitlements file shows a check mark under Push Notifications.
If it shows an error, than fix it.

I just Quit xcode and open it again resolved my issue. xcode (Version 11.7 (11E801a))

Make sure your project Bundle Identifier matches the App ID certificate at Developer portal.

i added this to my entitlements.plist and it's done.
<key>aps-environment</key>
<string>production</string>

I use "ionic package" and this work for me:
Go to https://developer.apple.com/account/ios/identifier/bundle
Edit "iOS App IDs" checking "Push Notifications"
Go to https://developer.apple.com/account/ios/profile
Regenerate and download app "iOS Provisioning Profiles"
Resend ".mobileprovision" file to Certificates in ionic apps panel
Work again "ionic package..." command

Related

React Native, ITMS-90078: Missing Push Notification Entitlement

I have got this mail each time I publish my app to app store:
Dear Developer,
We identified one or more issues with a recent delivery for your app,
"{appName}" {version} ({build}). Your delivery was successful, but you
may wish to correct the following issues in your next delivery:
ITMS-90078: 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 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.
After you’ve corrected the issues, you can upload a new binary to App
Store Connect.
Best regards,
The App Store Team
Add the push notification capability in signing&capability -> capability -> push notification. Make sure to add It to both the release and debug tab.
For people that still have this issue or maybe another issue that happens with entitlements like com.apple.developer.associated-domain or com.apple.developer.applesignin I have a few tricks for this.
And I've already did some suggestions around the forum that I search about it like re-create the provisioning profile, keychain, certificates, etc and re-enable capability in XCode, automatic signing and manual signing provisioning profile in XCode even I did upgrade my XCode to 13 and my macOS but the issue still happens.
After I archived my code, I get this summary before I upload it to AppStore.
Actually I have another entitlements like aps-environment, com.apple.developer.applesignin and com.apple.developer.associated-domain. But the summary didn't include those entitlements.
Push Notif, Sign in with Apple and Universal Links work like charm in development mode, but when the I install from TestFlight those feature didn't work anymore. And I didn't get any error messages while archiving until finish upload it to AppStore just email warning about missing push notifications entitlements.
So, here's what I do:
Check the codesign of archive build for the app via terminal. codesign -d --entitlements :- ${path_to_your_bundle_app}. For me, the bundle app is in /Users/${user}/Library/Developer/Xcode/Archives/${date}/${app_name}/Products/Application/${app_name}.app/${app_name}.app.
And what I got is
I just realize that the bundle app didn't include any entitlements
And then I signing it manually from my entitlements file to the bundle app. codesign --sign - --entitlements ${path_entitlements_file}/${filename}.entitlements --timestamp=none ${path_to_your_bundle_app}
Back to XCode and go to Window->Organizer. And try Distribute the App again.
And finally the summary for all entitlements that I need is included.
I don't know why this happen to me. Maybe there are something wrong in my config in XCode or my project code. However, now it's work in TestFlight even though I should still signing it manually after I archived my app.
Maybe anyone can help me about this. My stack is
React Native 0.63.3
XCode 12.5 and I update to XCode 13
MacOS 11.6

Error in Xcode 12.2: Provisioning profile doesn't include the push notifications entitlement

I am new to Xcode and I'm trying to build an archive to upload to the App Store Connect, but I am getting the following error:
Provisioning profile <my_profile_name> doesn't include the Push Notifications entitlement.
My app has the push notification feature and I'm using Firebase Cloud Messaging to deliver those notifications.
What I have tried so far:
Check the "Automatically manage signing", but Xcode fails to
provision the target.
Delete the provisioning profiles in ~/Library/MobileDevice/Provisioning\ Profiles and let Xcode regenerate them, but the error persists.
Create my own Provisioning Profile on
https://developer.apple.com/. It has the push Notifications enabled
capability, but the downloaded version of it doesn't have the
entitlement.
Add, delete and add again the push notifications
capability in the "Signing and Capabilities" tab on XCode.
Edit the entitlements file, and have created new Provisioning Profiles without any success.
Finnally, I have solved this error!
The problem was in the entitlements files on my project: they were generated with two entries:
Push Notifications with the boolean value 1;
aps-environment with the string value 'production'.
The right entry for the Apple Push Notifications service is only the aps-environment, so I just deleted the Push Notifications entry and now I am able to build the archive!
Thank you all for helping me!
Try doing the following:
Select your app target in project targets.
Click on the signing & Capabilities tab.
Click + Capability and add the push notifications capability.
I'm having a similar problem as well. Spoke with someone at apple and they said a few other people had complained as well.
If I validate the app, it fails Mac App Store validation, saying application- name entitlement error. If I validate for external distribution and notarization, it works fine.
In the same week I've updated 3 other mac app store apps with all the same signing certificates, and everything works.
The app I'm having a persistant problem with was open when I upgraded to 12.1.lastX, and then to 12.2. My bad... that was where things got mucked up.
I've tried every suggestion I can find, to no avail. Will probably rebuild from the ground up, or just wait for an update to Xcode.
It's Apple that created the problem, not me. Sometimes they ruin things.

App Store upload rejected by push entitlements problem

I had to make some changes in my old iPhone app in XCode.
When uploading it to the App Store I get the following problem:
"ITMS-90078: 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 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."
I have done it that it said. I regenerated all my certificates and so on, but it does not fix my issue.
When I click Fix issue, it comes again and again.
Anyway, I had it in my entitlements file (it does not help even if I update it to production)
My certs are ok:
What should I do?
Thanks a lot!
Finally, I could solve it:
I deleted all settings from Target / Build settings / Signing in XCode. I don't know exactly why it helped, probably it contained some settings from the past (note, it was not changed for years) that lead to this bug.
Although I leave my question here, hopefully it can save others day in the future.
Enable Push Notifications in Signing & Capabilities Section in Xcode.
I got the problem in xcode 11.3, then I fixed by this way:
Check and note your app Capability in Target -> Signing and Capabilities
Find and remove file name .entitlements in xcode bundle
Search and delete the value of "CODE_SIGN_ENTITLEMENTS" in target -> build settings -> search "CODE_SIGN_ENTITLEMENTS"
4. Add your app Capability again in Target -> Signing and Capabilities -> All

Xcode 8 "the aps-environment entitlement is missing from the app's signature" on submit

I've got an app that we've submitted dozends of versions to in the last 6 months and we do use APNS. I got the following email from Apple after upgrading to Xcode 8
Dear developer,
We have discovered one or more issues with your recent delivery for
APP_NAME. Your delivery was
successful, but you may wish to correct the following issues in your
next delivery:
Missing Push Notification Entitlement - Your app includes an API for
Apple's Push Notification service, but the aps-environment entitlement
is missing from the app's signature. To resolve this, make sure your
App ID is enabled for push notification in the Provisioning Portal.
Then, sign your app with a distribution provisioning profile that
includes the aps-environment entitlement. This will create the correct
signature, and you can resubmit your app. 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
What is weird is I went to developer.apple.com -> Certificates, Identifiers & Profiles and my AppId does have Push Notifications enabled still. I'm not doing anything different then I've ever done on it so am curious if the Xcode 8 update broke something. Any ideas?
BTW: The link they put for the Push Notification Programming Guide was broken in the email, so that's not a good sign.
Very easy actually. For some reason it got disabled on Xcode 8 but go to Targets -> Capabilities and verify Push Notifications is all correct on that view. For me it had a "Fix Me" I had to click, and voila.
I also have the same problem, and I'm sure Push notification is off by default in Xcode8. I didn't notice it. Be careful about it.
There was a change in Xcode 8, where your entitlements no longer come from the App Identifiers, but from the capabilities selected in your app target. So, like Unome (the OP) said, you have to verify that Push Notifications is switched on.
For me, it wasn't a "Fix Me" button, but I had two entitlement files (one for development and one for distribution). Toggling the Push Notifications capability would add the aps-environment key - with the value development - to the development entitlements file, but it wouldn't add it to the distribution entitlements file. Copying the same key over to distribution worked to get rid of the warning email when uploading to iTunes Connect.
For most projects, it should be sufficient to toggle on Push Notifications, or if it's already on but the key isn't in the entitlements, try toggling it off and on again.
It's also worth noting that entitlements automatically get updated during archive. ie the entitlements generated for release builds can be different from entitlements generated for development builds. See here
During the app distribution process through the Xcode Organizer >
Archives tab, entitlements are set onto the app by way of the
provisioning profile used for code signing. It is important to be
aware that the re-application of entitlements at this phase creates
the opportunity for unintended entitlement differences between any
prior development builds you may have tested. The primary purpose of
this document is to verify that your entitlements are correct for your
distribution builds for beta testing and App Store submission.
From the Xcode release notes:
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. (28076333)
This is a great change as it was always quite odd that the aps-environment entitlement didn't require the plist, but many others did.
For those of you that do not want to just blindly press "Fix Me" and do not currently have an entitlements file, it is just a plist file which is referenced in your project's Build Settings under "Code Signing Entitlements"
After a day of struggle with Xcode 8 we could not figure out why the aps-environment development was NOT added to our debug builds. It was missing from the entitlements section in the built app for debug testing... even though we had ENABLED the new Capability and the entitlements file existed. The issue is that the entitlements file needs to be set for ANY SDK in the Xcode Build Settings for Debug Entitlements.
I got the same email from Apple using XCode 7.3.1. What I did to solve the problem was:
Under Capabilities > Set PUSH notification ON as stated in #Bruce Tsai answer.
Under Build-Settings > Code Signing > Code Signing Identity set the developer cert for debug and the distribution cert for release, as is shown in the image:
Automatically manage signing was off for me, i checked and working fine for me.
If you're using Firebase frameworks and aren't using push notifications there are two solutions 1. just put up with the 'issue' message that gets sent to your whole team every time uploading a binary. The app will still be accepted as a submission as long as you're not actually using notifications you can ignore the warning. or 2. do this: https://stackoverflow.com/a/46802075/7529450 . This will remove the annoying email notification and also get accepted as a submission.
Using Xcode 9 push Notifications was enabled.
I tried disabling/re-enabling Push Notification capabilities. (didn't work)
I tried disabling/re-enabling Automatically manage signing. (didn't work)
Turns out I had to delete and re-add my provisioning profiles. (see here how to do it)
You might have to disable/re-enable Automatically manage signing after wards.
For me the problem was because there were two entitlements files: Entitlements-Debug.plist and Entitlements-Release.plist. And only one of them (Debug) has needed settings in it.
Changing multiple value of Build Settings > Signing > Code Signing Entitlements to a single MyAppName/MyAppName.entitlements and then reenabling Capabilities > Push Notifications switcher did the trick for me.
Hope it helps.
One more option that worked: copy-pasting the source of AppName/Entitlements-Debug.plist into AppName/Entitlements-Release.plist.

Missing Push Notification Entitlement warning

We have created an App ID, distribution certificate and provisioning profile. Push Notifications were not initially enabled.
We now need to implement Push Notifications in the app.
We have enable Push Notifications in the App D, check the provisioning profile, the provisioning profile was invalid, updated it, and downloaded the latest provisioning profile to use it for next time.
We then integrate the APIs for Push Notifications via APNS in our code.
After uploading the app in iTunesConnect, we get the following email from Apple:
Dear developer,
We have discovered one or more issues with your recent delivery for "Swanvi". 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.
We have re-checked the App ID. Push Notifications are enabled for development and production.
In the Provisioning Profile, the Push Notifications option is shown.
Why are we getting this warning via email?
You need to see 2 things: The provisioning profiles used by your account on Xcode and the ones on developer.apple
Its all about the provisioning profiles.
STEP 1:
Go to https://developer.apple.com/account/ios/certificate/ and see the Active iOS Distribution Provisioning Profiles you need for your app. Then click on it and make sure Enabled Services has Push Notification enabled. If it doesn't then click on edit and enable it by following the steps provided by Apple. If it is enabled then perfect.
STEP 2:
Delete any Invalid Provisioning Profiles you see related to app (just the invalid ones for YOUR app). I'll tell you why in the following steps.
STEP 3:
Go to Xcode -> Preference -> View Details (for your Account) -> [OPTIONAL: To be sure invalid one is gone, rt-click on any provisioning profile, select "Show in Finder", then Delete/Move all the provisioning profiles from that folder.] Now click Download All Profiles. This will replace local provisioning profiles with current ones. Click DONE.
STEP 4:
Go to your app Targets -> Build Settings -> In Code Signing, expand your Provisioning Profile to show Debug and Release tabs. By default it will be on Automatic (which is why your app was probably automatically using the invalid profile that we just deleted in step 2). For Release, to be on a safer side, select the Active Provisioning Profile with enabled Push Notifications as seen on step 1.
That's it.
You shouldn't get any emails now.
#Djeeraj V.S. is correct. Cordova added some conditional compilation to remove this requirement for apps that do not need Push notifications.
You could comment out the code in in Classes\AppDelegate.h as per this answer, but its better to add the compilation symbol DISABLE_PUSH_NOTIFICATIONS via the UI so you can continue to benefit from future Cordova upgrades.
I come from .NET background so i am familiar with conditional compilation but had to spend a bit of time working out how to get the compiler flag working in XCode.
Turns out the magic word here is 'Preprocessor Macro'. Here is how its done graphically via the UI (note that this the way its done in XCode 6.1):
Hope this helps other people out there in same situation.
In my case I've just checked again 'Capabilities' page inside project properties and pressed 'fixed issue' in the correspond APNS menu. Now it have to look like this
XCode 11. To handle press on Capability button (+)
I had the same warning and here is how I solved it.
First of all, when you archive your project, under entitlements if you don't see aps-environment and your app uses push notifications, then you will get the warning mentioned in the question.
FIX STEPS
1- Make sure your distribution profile is valid in Apple's Portal.
- If it's not, then regenerate it.
2- If your distribution profile is valid, then in XCode, navigate to Preferences and then click View Details. At this point under Provisioning Profiles, make sure you don't have invalid distribution provisioning files. If there are invalid ones, then make right click and move them to trash. If you don't have the valid one, then download it from the Portal.
3- Go to Build Settings -> Code Signing and for everything choose the distribution provisioning profile.
At this point if you archive, you can see aps-environment in your entitlements and the warning email won't come.
In my case, following practice worked.
Xcode 9.2
Disabled Automatically manage signing which appears in Build Target > Signing
Import provisioning profile manually.
I fixed that issue by below steps:
Open your project with Xcode
Click the Signing & Capabilities in Runner tab and then click the + Capability button. Type push in the filter field and press Enter.
After adding the push notifications entitlement, the Runner.entitlements file will have been created in your project
I have a cordova app, where I have had notifications previously, but wanted to remove it from the app. I tried following the above answers, but I still encountered this issue when I uploaded the build. I realized, that I had a plugin installed, who used the notification setting, and somehow kept some settings activated for notifications.
I solved the issue by removing the ios platform completely cordova platform rm ios, adding it again cordova platform add ios and making sure that the plugin was removed from the ios.json and fetch.json files.
2021 Xcode 12.4
I had the similar issue.my app uses push notification. For older release I never got such email from Apple. I think there's some issue with the Automatically manage signing.
Solution Do the Manual app signing
Disabled Automatically manage signing which appears in Signing & Capabilities
Import provisioning profile manually.

Resources