Profile doesn't include aps-evironmentProd, Xcode 10.1 - ios

I am trying to start my app on a device and faced with this. It doesn't depend on signing method. Push notifications feature enabled for the App ID in Developer account, valid APNS certs added. On the capabilities tab everything is OK.
I know what is aps-environment (this string presents in generated profile), but what does Xcode mean by environmentProd string? I can't find out just anything about "aps-evironmentProd".
The application started without any troubles on previous Xcode versions. For me it seems like regular Xcode bug. How can I handle this without Xcode downgrade?
Entitlements

It seems you have changed/updated APS Environment to APS EnvironmentProd in your .entitlements file.
Check your .entitlements again to be sure. If not just restart Xcode.
Also, I am assuming you already know following:
No need to update development to production in.entitlements`. Because we can't use the production certificate in debug/development.
When we do 'Archive' Xcode automatically set it to production.

I see this is old question but still I wanted to provide an answer as I had same problem.
I did try so many options, recreated provisions, certificates edit manually entitlements and nothing worked.
At the end I created new project with same name as my original app did all setup a nd there was no eny error for entitlements.
I have Uploaded app into appstoreconnect and tested all worked fine.
Then I copied entitlements file and appdelegeate into my original app and no errors after.

Related

Profile doesn't match the entitlements file's value for the application-identifier entitlement

I am trying to upload an app to the app store and I am getting this error on the page that has the certs. As far as I can tell I have changed the field so they have matched, but I am missing something.
Any help would be greatly appreciated.
I'm not sure why this fixed it, but I went into my Target's Capabilities tab, turned iCloud ON, tried to do an archive build, it failed, I turned iCloud OFF again, tried to do an Archive build and it succeeded, and after that it was able to automatically resolve certificates again.
Rightclick on Finder -> Go to Folder...
~/Library/MobileDevice/Provisioning
For Xcode 11
~/Library/MobileDevice/Provisioning Profiles/
Delete all provisioning profiles, done.
The app you created has an incorrect application-identifier value, for what the provisioning profile is expecting. The cert for appID com.example.foo for the team 2ABCDEFG will be expecting application-identifier: 2ABCDEFG.com.example.foo, your app declared that its appID was com.example.foo, but the application-identifier didn't match, either you are using the wrong team-prefix, or you have the bundleID misconfigured.
In my case, I am using build schemes to allow me to build a prod app and a qa app. com.example.foo for prod, and com.example.foo.qa for QA.
I had set my bundleIdentifier in the Info.plist to $(PRODUCT_BUNDLE_IDENTIFIER)$(BUNDLE_SUFFIX), which works great in the simulator and on device for having different apps, however, when the app generates its application-identifer during the archive phase, it must not be reading the bundleIdentifier generated by the Info.plist.
To remedy the situation, I edited FooProject.xcodeproj/project.pbxproj (with a text editor) to change my QA buildSettings PRODUCT_BUNDLE_IDENTIFIER to com.example.foo.qa
You can see Apple's Technical Q&A and this page to see their in depth dive into solving this. Once you run the following on your exported app:
codesign -d --entitlements :- ./Payload/myApp.app
and see what application-identifier your app was just built with, it should be pretty quick to realize what your are doing wrong.
I didn't find that page in my Google searching, because they don't actually use the phrase from the error message or call the application-identifier by its full name, but instead say App ID.
Also, the solution to this problem isn't to generate a new provisioning profile that has the application-identifier entitlement, it does have that entitlement, however, the value in the provisioning profile, and your app have to match.
Maybe the {project}.entitlements file was missing. Doing what #samkass mentioned will auto generates the file and it will work.
So basically just go to capabilities tab, enable anything, and disable it.
Changing the iCloud toggle to on, building, and disabling iCloud, got rid of the error saying that:
Profile doesn't match the entitlements file's values for the application-identifier and keychain-access-groups entitlements.
In Xcode 11, this could happen when a .entitlement file is not present for your project. The solution would be to add any random capability by clicking on '+ Capability' under 'Signing & Capabilities' (which leads to the creation of an .entitlement file) and then removing the capability. This will let you automatically provision a certificate too.
I'm developping a Flutter app with Flavors that use the --dart-define command.
I've been very inspired by this great article.
However I've encountered this 'application-identifier' issue when deploying.
I've tried a lot of options.
This solution is the one that worked for me.
It's very close to #n8tr's comment, but the difference was the 'instead'.
To resume, just set the Product Bundle Identifier to your.id.here$(DEFINEEXAMPLE_APP_SUFFIX) under Packaging in Build Settings instead of in Info.plist.
Please check your application features which required for your application like In app purchase , push notification , Inter App audio , Siri kit etc.
This is the only cause for this type of error.
Make sure that in your App id the above flags should be on.
Most of time it happens when you not configured push notification , In App purchase in you development App ID.
I went into my Target's Capabilities tab, turned Keychain Sharing ON and it starts working
For me, the trick was to
add/remove a capability for the target (in my case a Widget);
make sure the created entitlements file is listed in the build settings;
and to add the "APS Environemnt" key with value "development" to the entitlemenets file.
In Xcode 10, I got it working by moving the entitlements file to correct folder in Project Navigator. I didn't have the entitlements file, but I managed to get one by toggling features on capabilities tab.
I got this same error and none of the solutions above solved the problem in my case.
What did work for me was to change the "Can be debugged" setting in the "Entitlements.plist" file from "NO" to "YES."
In my case the issue was following: provisioning profile used for build step was created for different app id than provisioning profile used for export step.
So make sure you're using the same provisioning profile for build and export step.
What worked for me was that I made the archive in XCode 11, and did the upload in it Xcode 12 beta.
Just have a look, whether the "Sign in with Apple" capability is added along with other capabilities such as "Background Modes" & "Push Notifications"!
In my case, it was there.
So after deleting the "Sign in with Apple" capability, it got removed from the 'project.entitlements' file and the provision profiles got synced immediately.
Cross check capabilities in the app with options you enabled for your App Id in your developer account.
I tried a few options listed in the answers here but none helped, however, toggling the checkbox "Automatically manage signing" off and on fixed the problem.
TL;DR: check your App ID and make sure the services are matching what's in your target.
What happened to me was that I let Xcode 10.1 help me create an App ID, and after that, I run into the problem as described here. (I selected whildcard app ID when I created the app in iTunesConnect, so I didn't even realized this was done.) When I opened iOS developer portal, the new app ID has Game Center and In App Purchase enabled automatically.
Since I couldn't enable Game Center in your Target -> Capabilities, I enabled In App Purchase, and then my app could be signed and uploaded.
When we faced the same issue, we tried all the above things but none of it worked.
What worked for us is changing the bundle identifier so that it was not identical to the previous one, for example "com.name.App" to "com.name.App2"; let xcode attempt to fetch/create provisioning profile and then chance it back to the original one.
Got this idea from this thread on Apple's developer forums- https://forums.developer.apple.com/thread/114539
I came across this page recently after trying to create a duplicate target - none of the suggestions were working for me. Further investigation, and some amount of hair pulling, eventually led me to scouring through the build settings for my app to try and figure out what was wrong.
It turned out that my project was still pointing to the entitlements file of the ORIGINAL target, rather than having one of its own. To resolve this, I navigated to the original entitlements file in Finder (e.g. ${SRCROOT}/MyProject/Entitlements/TargetName.entitlements), created a copy within the same folder and then renamed it (e.g NewTargetName.entitlements).
Then, I opened my new entitlements file and changed the application-identifier field to match the ending of my new target's bundle identifier (e.g. ABCDEFGH.US.co.fake-company.superduperapp-newtargetname).
Finally, I updated the 'Code Signing Entitlements' field in the build settings to the path of my entitlements file (for me, this was something along the lines of ${SRCROOT}/MyProject/Entitlements/TargetName.entitlements).
I returned to the Signing & Capabilities tab, and lo, the issue was fixed. Hope someone out there finds this useful.
Go to Xcode's Info tab and change Bundle identifier field - after changing app name it didn't change even though I changed Bundle Identifier on the General tab. The above fixes did not work for me but this one did instantly.
I had this issue with a brand new app, in Xcode 12 beta 3 (app submissions started today).
Xcode had "Automatically manage signing" on. However, the Team ID displayed in the "Signing Certificate" didn't match the Team ID displayed in iTunes Connect website. This was the root cause preventing the app from being uploaded.
How I fixed it:
I manually created a provisioning profile for App Store distribution
In Xcode, I tapped on "Download manual profiles" in Preferences -> Account
Then, I turned off "Automatically manage signing".
Once I selected the provisioning profile in the dropdown, the correct Team ID appeared under "Signing Certificate"
I ran into the same issue while setting up a Gitlab pipeline that runs exportArchive cmd and uploads to AppStore. I was able to get it to work by changing the DEVELOPMENT_TEAM in Build Settings to the same Team selected in Signing & Certs.
Because previously it was set to blank which was using another DEV TEAM id by default which was incorrect and didn't match and it was complaining about the "application-identifier" = 12331232.com.bannana.apples.peach not matching. Which lead me to setting the correct DEV TEAM and it worked.
Xcode ver: Version 11.3.1
I hope this helps somebody.
Our Setup
Multiple targets:
sub-apps
watch
app clip
today widget
...and use iCloud.
Turning iCloud on and off was not an option for us. We already use it in production and rather not mess with it... I got the original question's message and this variation at some point as well:
Profile doesn't match the entitlements file's values for the
application-identifier and keychain-access-groups entitlements.
Solution
Hinted from other responses here, We made sure that all targets would have a .entitlements file. If the target had none we created an empty one like so:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
...and pointed it's target Code Signing Entitlement in Build Settings to the empty .entitlements file.
Solved!
Delete all profiles located in ~/Library/MobileDevice/Provisioning Profiles/
in my case , I had to put :
<key>aps-environment</key>
<string>development</string>
in all files with extension .entitlements
In my case I am creating multiple apps from one code base using --dart-define, and building flavors in flutter app.
I have done everything right but only one
as mentioned in the comment above
https://stackoverflow.com/a/65292545/8787695
I have already written app_suffix in the build settings (PRODUCT_BUNDLE_IDENTIFIER = com.flutter.myapp$(APP_SUFFIX)).
but I have also written app_suffix in the info tab to the Bundle identifier.
I have the same problem because I had a wrong value in iCloud Key-Value Store inside the entitlements file. I set the following value and the error was solved:
iCloud Key-Value Store = $(TeamIdentifierPrefix)$(CFBundleIdentifier)
Removing this fixed the issue on my side.
OTHER_CODE_SIGN_FLAGS = "--deep";
My main target had this build setting and that way it overwrote the code signing entitlement of the embedded application with the parent code signing entitlement.

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.

Crashlytics: "MyApp could not be installed at this time" when adding entitlements

I'm trying to distribute a beta version through Fiber/Crashlytics. I've been doing this for ages but this time I'm unable to make it work correctly (iOS9+).
My app uses icloud keyvalue store, IAP and push notifications, so it has an entitlements file. The thing is, when I archive and distribute the app, Crashlytics sends the email with the new version to testers and they are able to install it BUT, as soon as it ends installing, a "…could not be installed at this time" appears and the app deletes itself. In the other hand, if I remove the "code signing entitlements" value from Building Settings, the installation works ok (but icloud and other things aren't working, of course).
What am I doing wrong? Is there a workaround for this situation?
It turns out that the entitlements file had something wrong (even when I've never edited it by myself!). I had enabled and disabled the required capabilities trying to fix my problem but it didn't worked until I deleted the entitlements file and forced Xcode to recreate it by enabling capabilities again.
After that, I've hadn't any problem to archive and distribute my beta.

The executable was signed with invalid entitlement [duplicate]

The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.(0xE8008016).
I am getting this error. please help me.
I have create the provisioning profile and change the bundle id. I have enable the keychain sharing from Target->Capabilities and generate the new .entitlement file. and i have also change the bundle id in that.
In my case (using XCode 10.0) nothing worked but this:
File > Project Settings... > Shared Project Settings: > Build System
--> Selected "Legacy Build System" instead of the default "New Build System (Default)".
For me in Xcode 5.1, I was getting The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. when trying to test the app on my device. Device Development Certificate has to expire Feb 2015.
Issue was resolved:
Selected Target->Capabilities, under GameCenter, here I was getting error on GameCenter entitlement as it was not added to project, although first version of application was released via same XCode 5.1 but there were no errors like this before.
Below, a button was given with title Fix Issue. When clicked it added the GameCenter entitlement and issue was resolved.
After wards the screen looks like:
For me, there was nothing to do with certificate or bundle identifier. App now runs successfully on the device.
In XCode 7.3 I encountered the same question, I 've made the mistake because:
Name in (info.plist -->Bundle identifier) is not the same as (target-->build settings -->packaging-->Product bundle identifier). Just make the same, that solved the problem.
As others have pointed out, if you get this error, you need to check that the Bundle ID value in both your .plist file and also here:
First of all, you should check bundle id, provision profile and certificate with private key (.p12).
If it doesn't help. Be sure that the Code Signing Entitlements has correct value or remove it at all.
File > Workspace Settings > Build System > Legacy Build System
This worked for me.
Xcode 10.0
Reassign the value of Automatically manage signing, this works for me
In my case, the app main Target's Team was different from Tests' Target Team. Changing the Tests' Team to the same Team as main Target's solves the issue.
None of the previous answers either applied or worked for me. In my case, updating the settings of the test project, as follows, fixed it:
One possible reason for this error is: your annual subscription has been renewed. Once the subscription is renewed, all devices related to the active provision profiles will be detached.
The admin must reactivate the list of devices for the new subscribed year.
The admin must delete last year provision profiles. (all are useless).
The admin must regenerate new provision profiles for the new year with the list of devices of his choice.
After this, rebuild project with Xcode and the error will disappear.
Had this issue. My main app and extension belonged to the same app group id correctly, but there was also one more app ID not in my project that shared said app group id. I had to remove this last app ID's association with the app group.
I was having same issue on Xcode 7.3 with iPad Air 2 with iOS 9.3.4!
Then I tried many options.
Finally I deleted profile from device, changed bundle identifier in project settings, and whola!
It worked for me.
P.S. I was using free provision profile using free Apple ID.
for me, just press cmd+, then go to account ,chose your developer account refresh(XCODE6) OR download all (XCODE7) will fix.
This happened to me when I was trying to build an App-store ipa exported file on my device, I had to export ad-hoc instead.
You should check provision profile is Product or Develop, if your project use multi configuration
You should check configuration which called by schema, because it must make sure, your configuration was set provision Develop
Check your bundle identifier and your profiles. If you have a profile for a specific bundle identifier and no team ones and your bundle identifier does not match it will give you that error.
Bundle identifier is in General section of your project properties and the profiles you can check in build settings.
In my case, I had a duplicate Provisioning Profile with the same name. This was accidentally created when I added an share extension to my project, stash all of those changes with git, and created a new share extension with the same name (com.companyname.project.share-extension-name). Deleting the Provisioning Profile in the developer member center (developer.apple.com) fixed this for me.
Had this issue with a cordova / ionic3 app, was caused by forking a main app and not selected again the legacy system in project settings. I selected legacy and the entitlements bs went away.
Had the same problem, nothing was helping, but I looked in Info.plist and found out that bundle ID was changed to other name (I don't know how it happened), so when I changed it to correct one everything was fine again.
I have also this problem when I do with XCode project what is exported from cordova framework.
Resolution : You have to create Apple-ID and Provisioining-profile by yourself. Because Xcode seems to be unable to create it for you.
For me, it was an inconsistency between Debug profile (it was automatic) and Release profile (it was manual). Setting them both automatic/manual resolved the issue.
I had to delete all the provisioning profiles by following this article.

Entitlements file do not match those specified in your provisioning profile.(0xE8008016)

The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.(0xE8008016).
I am getting this error. please help me.
I have create the provisioning profile and change the bundle id. I have enable the keychain sharing from Target->Capabilities and generate the new .entitlement file. and i have also change the bundle id in that.
In my case (using XCode 10.0) nothing worked but this:
File > Project Settings... > Shared Project Settings: > Build System
--> Selected "Legacy Build System" instead of the default "New Build System (Default)".
For me in Xcode 5.1, I was getting The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. when trying to test the app on my device. Device Development Certificate has to expire Feb 2015.
Issue was resolved:
Selected Target->Capabilities, under GameCenter, here I was getting error on GameCenter entitlement as it was not added to project, although first version of application was released via same XCode 5.1 but there were no errors like this before.
Below, a button was given with title Fix Issue. When clicked it added the GameCenter entitlement and issue was resolved.
After wards the screen looks like:
For me, there was nothing to do with certificate or bundle identifier. App now runs successfully on the device.
In XCode 7.3 I encountered the same question, I 've made the mistake because:
Name in (info.plist -->Bundle identifier) is not the same as (target-->build settings -->packaging-->Product bundle identifier). Just make the same, that solved the problem.
As others have pointed out, if you get this error, you need to check that the Bundle ID value in both your .plist file and also here:
First of all, you should check bundle id, provision profile and certificate with private key (.p12).
If it doesn't help. Be sure that the Code Signing Entitlements has correct value or remove it at all.
File > Workspace Settings > Build System > Legacy Build System
This worked for me.
Xcode 10.0
Reassign the value of Automatically manage signing, this works for me
In my case, the app main Target's Team was different from Tests' Target Team. Changing the Tests' Team to the same Team as main Target's solves the issue.
None of the previous answers either applied or worked for me. In my case, updating the settings of the test project, as follows, fixed it:
One possible reason for this error is: your annual subscription has been renewed. Once the subscription is renewed, all devices related to the active provision profiles will be detached.
The admin must reactivate the list of devices for the new subscribed year.
The admin must delete last year provision profiles. (all are useless).
The admin must regenerate new provision profiles for the new year with the list of devices of his choice.
After this, rebuild project with Xcode and the error will disappear.
Had this issue. My main app and extension belonged to the same app group id correctly, but there was also one more app ID not in my project that shared said app group id. I had to remove this last app ID's association with the app group.
I was having same issue on Xcode 7.3 with iPad Air 2 with iOS 9.3.4!
Then I tried many options.
Finally I deleted profile from device, changed bundle identifier in project settings, and whola!
It worked for me.
P.S. I was using free provision profile using free Apple ID.
for me, just press cmd+, then go to account ,chose your developer account refresh(XCODE6) OR download all (XCODE7) will fix.
This happened to me when I was trying to build an App-store ipa exported file on my device, I had to export ad-hoc instead.
You should check provision profile is Product or Develop, if your project use multi configuration
You should check configuration which called by schema, because it must make sure, your configuration was set provision Develop
Check your bundle identifier and your profiles. If you have a profile for a specific bundle identifier and no team ones and your bundle identifier does not match it will give you that error.
Bundle identifier is in General section of your project properties and the profiles you can check in build settings.
In my case, I had a duplicate Provisioning Profile with the same name. This was accidentally created when I added an share extension to my project, stash all of those changes with git, and created a new share extension with the same name (com.companyname.project.share-extension-name). Deleting the Provisioning Profile in the developer member center (developer.apple.com) fixed this for me.
Had this issue with a cordova / ionic3 app, was caused by forking a main app and not selected again the legacy system in project settings. I selected legacy and the entitlements bs went away.
Had the same problem, nothing was helping, but I looked in Info.plist and found out that bundle ID was changed to other name (I don't know how it happened), so when I changed it to correct one everything was fine again.
I have also this problem when I do with XCode project what is exported from cordova framework.
Resolution : You have to create Apple-ID and Provisioining-profile by yourself. Because Xcode seems to be unable to create it for you.
For me, it was an inconsistency between Debug profile (it was automatic) and Release profile (it was manual). Setting them both automatic/manual resolved the issue.
I had to delete all the provisioning profiles by following this article.

Resources