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

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.

Related

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.

Xcode The executable was signed with invalid entitlements [duplicate]

This question already has answers here:
The executable gets signed with invalid entitlements in Xcode
(40 answers)
Closed 2 years ago.
I would install an application in my mobile phone by using Xcode but it was not installed with following an error message.
Error Message
"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)"
Matters of Inquiry
Why does the error message occur while I install the application?
Would you mind if you can give me the solution of this problem?
Check if you are using Entitlement file in Build Setting > Code Signing Section.
If yes, try deleting that file name.
You are using Entitlement file
The entitlements file defines certain capabilities of your app. Usually, the file is automatically generated by Xcode when you enable a capability for your app. You only need the file if you enable certain capabilities, e.g. Healthkit integration. If you'd like to use these features, you have to add it. Otherwise, Apple will reject your app.
To fix this
Go to the build settings of your target.
Make sure that you have "All" selected instead of "Basic"
Type "entitlements" into the search box
The result is the build setting where you can specify where your
entitlements file is located
Remove them
You are using the wrong Provisioning Profile
A provisioning profile is a collection of digital entities that uniquely ties developers and devices to an authorized iPhone Development Team and enables a device to be used for testing. A Development Provisioning Profile must be installed on each device on which you wish to run your application code.
Go to Build Settings > Code Signing > Provisioning Profile
Select a development profile under Team
Please ensure that the Team in the project, target and tests are the same.
Bundle Identifier and App ID do not match
Go to the build settings of your target
Select Packaging and change your App ID to match the Bundle ID
Clear cache in Xcode
Command-Option-Shift-K to clean out the build folder. Even better, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually.
You are using wrong provisioning profile to build your app on devices make sure you are using right type of profile. I was using App Store Deployment profile to build on devices. Use ad-hoc profiles or development profiles to build on your devices.
You are using the wrong Provisioning Profile i.e. Distribution for development. Go to Build Settings > Code Signing > Provisioning Profile and select a development profile.
Check the if your "Code Signing" configurations are same on "PROJECT>Build Settings" and "TARGETS>Build Settings".
Personnally, I use for both:
- "Code Signing identity": iOS Developer
- "Provisioning Profile" : Automatic
Check your "Team" parameter at your targets. It should be the same for your project and tests.
For me none of the above answers worked. I tried to remove every code signing certificate from Keychain and build the app. When I resolved all code signing related errors for my target I still had some of them in Tests target. It has been set by someone else from my team before. I just switched to iOS Developer, and the invalid entitlement error went away.
I was getting this problem after moving app from one account to another. I tried all the solutions given by others, those might be correct in other cases. But I fixed the problem by going File -> Workspace Settings -> Build System and choosing "Legacy Build System". I'm using XCode 10.3.
I faced this problem and my problem was My Bundle Identifier and AppID was not matched. Please change your Bundle Identifier in Build Settings->Packaging like your AppID.
Just goto Apple developer portal from where you have downloaded provisioning profile.
Select your profile click edit and check whether all certificates are selected or not.
In my case selecting all certificates and downloading that new profile solved the above mentioned issue.
Also make sure in your schema you have set "Build configuration" to the correct configuration, in most cases "Debug".
I got this error when export the ipa with App Store provisioning wrongly during CI process. My intention was to export with Adhoc provisioning.
I had the same error. My problem was that I checked 'Enable HealthKit' in Entitlements.plist, but I did not enable HealthKit when I created the App Id.
In short, all entitlements in your app (Entitlements.plist file in your project) should be configured on the provisioning profile you use (Provisioning profile = app ID + certificate + information about devices your app can run on).
Had the same problem that suddenly popped up in my project from one day to the next.
What fixed it for me was turning "Automatically manage signing" off and on again for both targets and making sure the right development team was selected once it was on again (defaults to none in my project).
It could seems a easy solution but I solved updating my iPhone's iOS version.
All answers I have seen talk only about xcode update. It was strange because my old iOS version was iOS 13.3.3 and it worked on another iPhone with iOS 13.6. After updating to iOS 13.7 it worked.

Xcode6 error: "No matching provisioning profiles found for application"

I'm trying to submit my iOS app in Xcode6. When I click Submit or Validate in the organizer, a window pops up that says:
Failed to locate or generate matching signing assets:
Xcode attempted to locate or generate matching signing assets and
failed to do so because of the following issues:
No matching provisioning profiles found for "Applications/MyApp.app”
None of the valid provisioning profiles allowed the specified
entitlements: application-identifier, beta-reports-active,
keychain-access-groups.
I have created a distribution provisioning profile for this app in the member center and it appears in Xcode.
I've looked around and have not found anything online that has told me how to fix this. Can anyone help? Thanks.
Andy
There's a couple possibilities for your issue, but the main causes is what I got from experience as well as other SO answers.
Your certificate or profile is outdated, in which case you have to go and regenerate your profiles again. I had this problem before, but Apple has described (partially) this issue.
You haven't set your profile in the Build Settings/Code Signing area, along with the appropriate certificates. Verify your Team in General/Identity and ensure that your profile is properly set.
From Xcode 5: Code signing entitlement errors (The image is a bit outdated, but its the same as Xcode 6):
You are using a beta version of Xcode.
#jaytrixz states: "I just removed Entitlements.plist in Code Signing Entitlements under Build Settings" which could possibly work. Be sure that your provisioning profiles are configured as well.
As jaytrixz, wrote in the comments...
"I just removed Entitlements.plist in Code Signing Entitlements under Build Settings "
I did the same and it worked after an hour of trying other things!
There are a lot of answers here, some have worked for me in the past, but not this time. I'd even created a new provisioning profile but that still did not help.
Based on the "None of the valid provisioning profiles allowed the specified entitlements" part of the error I tried the following on a hunch and it worked for me:
1. add and remove a particular Capability
Go to Targets > Capabilities, and turn one on and then off.
I doubt it matters which you choose, I added "Push Notifications" (which I don't need for my app), once it was "ON", I changed it back to "OFF"
2. Archive again
I am now successfully uploading my app to the store.
Another solution, that fixed this symptom for me, can be found at: Xcode Watchkit: None of the valid provisioning profiles allowed the specified entitlements: beta-reports-active, com.apple.security.application-groups
Briefly: clear ~/Library/MobileDevice/Provisioning Profiles
If you are sure you have valid certificate and provisioning profile, then you may need to do the following:
I would suggest people to refresh the link between xCode and developer account by doing the following:
Go to Xcode -> Preferences -> Account -> View details -> (Refresh icon)
Otherwise you may not be able to see the provisioning profile as an option in the build settings (You may only see old profiles)
A lot of times it gives me connection error, you may need to retry.
Do this refresh every time you edit the provisioning profile or certificate online on apple developer member center
If certificates and build setting are all good, and you are part of multiple teams, make sure to select the proper team for the app.
Clean and archive again.
I had another cause for this problem.
I had 3 different Configurations (Debug, AdHoc, AppStore). I accidentally had the AdHoc Configuration selected in the Archive Scheme setting and tried to upload the generated archive to the AppStore.
So setting the Archive configuration to AppStore solved the problem for me.
It's the year 2017, and the provisions are still not just working. I had to put them on manual mode because automatic didn't worked after struggling half an hour. I have no idea what are those entitlements, i have no entitlements file.
After trying every possible fix in the world, I ended up just adding this to the entitlements file:
<key>beta-reports-active</key>
<true/>
Find the right entitlements file by looking in Targets > Build Settings > Code Signing > Code Signing Entitlements.
Maybe it's something to do with this Apple doc, although I couldn't follow the instructions fully as certain things were missing in XCode 7 (e.g. the refresh icon in Preferences > Accounts).
Another possible cause for this message is if you accidentally did remove the 'target inclusion checkbox' for the entitlement file – in that case the error message is slightly misleading...
In my case, the problem was caused by different Bundle Identifier in Target General tab than in Build Setttings.
If you have only development provisionning profile, just create distribution also
I played with fastlane gym, and there it gave some interesting insights:
There was an error exporting your application Unfortunately the new
Xcode export API is unstable and causes problems on some project You
can temporary use the :use_legacy_build_api option to get the build to
work again
This is the according Bug-Report. Seems to be unfixed for month.
https://openradar.appspot.com/radar?id=4952000420642816
Building the app in legacy mode worked for me.
gym --use_legacy_build_api true
Hope, this helps anyone.
In my entitlement file for Health kit there was development key. I removed that and my problem resolved.
I hope this answer could help :)
There seem to be many possible causes of this error.
In my case, my app was an Enterprise release and I was clicking "Validate" when I should have been heading straight to "Export".
I found this in the Apple docs:
Validate or Submit is not intended to be used with Development, Ad Hoc or Enterprise builds. Ad Hoc or Enterprise distributions should skip straight to Export.
Source: https://developer.apple.com/library/content/qa/qa1830/_index.html
I ran into this issue using App Groups. To resolve, I had to log into developer.apple.com and reassign the App Group ID to my App ID.
If other solutions do not work, try going to XCode -> Preferences -> Accounts -> View Details
Now look in Provisioning Profiles section. If your provisioning profile has an action button of 'Download', click the button and download. Then try again
Create a new provisioning profile
This solution worked for me when I had this problem.
Step by step :
log onto the apple developer portal and go here : https://developer.apple.com/account/ios/profile/production
Click the [+] add button and fill in a new profile name and select your app ID
Click the Download button, and once it has downloaded double click to open that file in Xcode
Re-Archive, and this time you should be able to upload succesfully to the store

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.

How to fix "no valid 'aps-environment' entitlement string found for application" in Xcode 4.3?

I've been trying very very hard to create a simple simple iOS app which can recieve push notifications. My only reason for doing this is to establish a procedure for some other team members to use, and have not been able to find an up to date, working version of such instructions elsewhere on the web. Our shop is fairly new to iOS dev, I personally am completely inexperienced with iOS dev and Xcode. I've stumbled through tens of tutorials, articles, and trouble posts from Apple and elsewhere and I feel like I might be nearly there...
Here is where I've got to (note I'm using Xcode 4.3 and trying initially to deploy just to iOS 5.1, and I gather that some things may have changed recently vs earlier versions of Xcode, but again I'm new to all this -- and finding it completely confusing and convoluted):
1) I've got a provisioning profile on my iPhone which has Push enabled
2) In my test Xcode project I've got that provisioning profile selected as the signing identity (in Build Settings > Code Signing)
3) I've got my bundle identifier under Summary and Info > Custom iOS Target Properties set properly* (I think??)
4) I've got registerForRemoteNotificationTypes being called in my delegate's didFinishLaunchingWithOptions
5) I've got didRegisterForRemoteNotificationsWithDeviceToken and didFailToRegisterForRemoteNotificationsWithError in my delegate, set up to log the device token or error respectively
6) I've got Enable Entitlements checked under Summary.
7) Right below that the Entitlements File selected is Tinker6 (the name of my test project), which was generated automatically when I checked Enable Entitlements
8) In the Tinker6.entitlements file I've got the following (which I've gathered is correct based on several different posts all over the web, but which I can't find anything definitive from Apple itself on):
Updated
9) Also, I have tried the whole thing without an entitlements file, and get essentially the same result.
10) My mobileprovision file contents include entitlements properly (I've scrambled the number and domain but structurally the same):
<key>application-identifier</key>
<string>12355456A7.com.whatever.tinker</string>
<key>aps-environment</key>
<string>development</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>12355456A7.*</string>
</array>
/end update
When I attempt to run this on my device, I get the following error in Xcode output:
2012-06-11 12:45:23.762 Tinker6[13332:707] Failed to get token, error:
Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment'
entitlement string found for application" UserInfo=0x24a3b0
{NSLocalizedDescription=no valid 'aps-environment' entitlement string
found for application}
I've tried setting get-task-allow to NO, aps-environment to production, all four possible combinations, same thing.
How can I get past this? Where is definitive documentation on this?
-- further background follows --
*As far as the bundle id, I am still not clear on how this should be set in relation to App Ids and Profile ids in the Provisioning profile. In the Provisioning portal under App Ids I have this (again, scrambled the number and domain):
And the two places bundle id is set I have this:
I am not at all sure these are correct or whether one or both should be set to 12355456A7.com.whatever.tinker, though I've tried those earlier in the process with no success...
Note I realize there are many posts with similar titles, however they all seem to be out of date based on the file names and so-forth given, and the fact none of the solutions seem to be useful. I'm hoping the greater level of detail I've given will warrant a quality response. I will probably assign a bounty as soon as possible and if you give a high quality answer that leads to a solution I will award you the bounty as well as promote your answer via twitter and my blog. Especially if you crosspost post a really good "here are the exact 500 steps you need to get a simple push notification app working including provisioning and whatever else" article on your blog or whatever.
If you created your provisioning profile before configuring the app ID for push, try to regenerate the provisioning profile.
iOS Provisioning Portal -> Provisioning -> Your cert -> EDIT -> Make
an edit -> Download new provisioning
Worked for me. Now i'm able to use push.
First of all, you don't need the entitlements file unless you are adding custom key/value pairs that do not exist in the provisioning profile. When your app is built, any entitlements from the provisioning profile will be copied to the app.
Given that you still see an error message about missing entitlements, I can only assume the code signing options are not correct in the build settings.
You need to make sure the correct profile is selected for the "Debug" configuration, and to be safe, that you have selected the correct profile for both the "Debug" and child-node labelled "Any iOS SDK":
Although this screenshot shows the "Automatic Developer" profile selected, choose the exact provisioning profile you want from the drop down, just for testing purposes. It could be that Xcode is automatically choosing a different profile than the one you want.
Also be sure to do a clean build, completely delete the app from your device, etc. This is just to make sure you don't have some old fluff hanging around.
I have faced this issue in Xcode 8.
You must have to enable Target—> capabilities—> push notification.
Check the screenshot.
Easiest way is to do this from your accounts with Xcode:
Head over Xcode -> Preferences -> Choose Accounts Tab -> View Details -> Hit refresh button on the bottom left -> Done.
Build again and it should work.
Ok, I faced the problem before. Since push notification requires serverside implementation, for me recreating profile was not an option. So I found this solution WITHOUT creating new provisioning profile.
Xcode is not properly selecting the correct provisioning profile although we are selecting it correctly.
First go to organizer. On the Devices tab, Provisioning profile from Library list, select the intended profile we are trying to use. Right click on it and then "Reveal Profile in Finder".
The correct profile will be selected in the opened Finder window. Note the name.
Now go to Xcode > Log Navigator. Select filter for "All" and "All Messages". Now in the last phase(Build Target) look for the step called "ProcessProductPackaging" expand it. Note the provisioning profile name. They should NOT match if you are having the error.
Now in the Opened Finder window delete the rogue provisioning profile which Xcode is using. Now build again. The error should be resolved. If not repeat the process to find another rogue profile to remove it.
Hope this helps.
The answer was: start over, do everything the same but create a new provisioning profile, and install it. That worked. Inspecting all the details (entitlements in mobile provision) looks exactly the same as everything in my question here. But now it works. Apple: WAT?
Of course, it would have been obvious to do this if it was possible to delete provisioning profiles. But since that's not possible, I didn't want to clutter our team with a bunch of test profiles. Still, finally lost patience and tried it anyway, and it ended up working. Whatevs.
Delete old provisioning profile from XCode in Organizer.
Then, generate a new provisioning profile for the same bundle id in iOS provisioning portal (after you have enabled push).
Import the new provisioning profile in XCode, set it in your app build settings.
Build, run, it works.
I just did it.
It took me 10 minutes from error to success.
XCode 6.1.1, and multiple apple developer accounts
Another answer for this already fairly comprehensive mix: I came across this issue again today, and this time it was due to my having multiple apple accounts. I needed to first add the 2nd developer account in XCode > Preferences > Accounts > +
Ensure that the Push Notification Capability is ON
Next I needed to actually explicitly enable In-App Purchase in the app (I did not need to do this previously). XCode > (the app window) > Targets > Capabilities > In-App Purchase ON (and at this stage I was given the option to choose the correct certificate)
Note that I had already added the Push enabled certificate by double clicking it in Finder.
(Xcode 5) Well, after spending an hour I solved my issue. Even if you re-generate the provisioning file in Xcode 5, you should manually update your account. I only changed provisioning file in the Organizer tab that did not work, Xcode kept build with old provisioning file.
So go to
Xcode > Preferences > Accounts > View Details (Select your account)
Then refresh your provisioning files.
My problem was simply that I was signing with the Xcode-managed wildcard provisioning profile.
After I created an app-specific profile (and downloaded it, double-clicked it, and ensured my Build Settings referred to it), I successfully received an APNS device token.
I had the same issue was everyone else and tried all the above tricks, nothing worked. I even deleted and started fresh with a different developer account.
What worked for me in the end was
Do as suggested above and create APP ID
Then create provisioning profile
DO NOT use the team wildcard profile (managed by xcode one) in the development section of the provisioning. You need to make a separate one using that app ID that you've made push notification active for. This way when you develop it will have the push notification function built in.
I don't know if you can enable that for a wildcard app, but after trying at least 12 different suggestions and losing a few days I hope this helps someone
You mention a provisioning profile but I don't see any mention of an Apple Push Profile.
To use Push you must have a push profile (there are two, one for development and one for release). After you've created it you'll need to make sure it contains the relevant certificates (see the EDIT section below).
This is an excellent tutorial that will walk you through all the steps:
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
It would take me, or anybody else, hours and hours to write a thorough detailed answer like this tutorial, so I'm not going to attempt to, nor lay claim to the bounty when this tutorial already exists.
P.S. I believe you don't need entitlements any more, this is a legacy thing.
EDIT:
You should also check you have the necessary profiles on the device - go to the settings, then general, profiles, check your profiles are listed, especially the push profile of course.
You can also check this from the Organizer section of XCode. In Organizer there are two sections that say Provision Profiles - one at the top left in Library (this is the profiles in XCode that you use to sign etc.) Also you will see a section call Provisioning Profiles for the device that is connected, this is the profile that is installed on the handset.
If you don't have them installed on the handset you can download them from the provisioning portal website, then click on the Add button at the bottom of the Organizer window.
While in the provisioning portal you should also check that the Apple Push Profile includes the certificates:
- click on Provisioning on the left hand menu
- you'll see a list of your profile, select to EDIT the Apple push profile
- you'll see a certificates section, with a list of developers or testers etc. you have in your project, make sure the check box is checked for them.
- you'll also see a devices section, make sure the device you are testing on has been added.
If you have any old profiles in XCode or on the device delete them and download/refresh/install all the new profiles from the provisioning portal
Ran into this same issue myself. For me, the issue was that my product name ($TARGET_NAME) was not capitalized the same way presented in the certificate provided by apple. For example, i had com.companyid.APNDemo whereas the Apple cert was using com.companyid.apndemo.
I changed my target to be lowercase and it worked. Note: The clue for me was the codesigning setting in Build Settings was set to my default developer certificate; not the APNTest provisioning profile.
A lot of the above answers are correct. However, there seems to be more than one possible error when dealing with this.
The one I had was a capitalization issue with my App ID. My App ID for some reason wasn't capitalized but my app was. Once I recreated the App ID with correct capitalization, it all worked smoothly. Hope this helps. Frustrating as hell though.
P.S. if it still doesn't work, try editing the Code Signing Identity Field manually with "edit". Change the second line with the name of the correct provisioning profile name.
It took me hours to solve it. Given that someone is using custom scripts to sign and pack while others are using xcode itself, there's only one way to check what ended in your app. Dump you entitlements with
codesign --display --entitlements :- path/to/MyApp.app
and check aps-environment and application-identifier.
This error may occur when your certificate has expired.
The solution is to renew certificate and sign the application with it.
You need to make sure you have in your provisioning profiles (https://developer.apple.com/account/ios/profile/) an iOS Distribution profile.
When you upload from xCode to the App Store, make sure you have the aps-environment in the entitlements. If not, download them from the View Accounts -> View Details -> Download All.
I had a similar issue. I've been bouncing between XCode 7 and 8 for a variety of reasons. Once you use 8 to build, you will need to use 8. I simply used Xcode 8 and applied some of the changes suggested above and it worked.
recreating provisional files fixed my all problems.
There seem to be something quirky with the 'automatic' entitlements in Xcode 4.6.
There is an Entitlement.plist file for each SDK at:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/Entitlements.plist
A workaround solution I came up with was to edit this file and add the sneaky aps-environment key manually 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>
<key>application-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>aps-environment</key>
<string>development</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
</array>
</dict>
</plist>
Then, Xcode is generating correct Xcent file, which contains the aps-environment key at:
/Users/mySelf/Library/Developer/Xcode/DerivedData/myApp-buauvgusocvjyjcwdtpewdzycfmc/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/myApp.xcent
You can locate where your Xcent file is created using Xcode's Log Navigator,
look for "ProcessProductPackaging".
Unfortunately, this is the only way I found that fixes the issue.
(and finally able to properly get push token now)
Just wondering if another more elegant solution is available.
Please see my SO question for more details on that:
Xcode 4.6 automatic entitlement not working - "no valid aps-environment"
Before deleting and regenerating AppIDs/Profiles, make sure your Library and Device have the same (and correct) profiles installed.
I started seeing this error after migrating to a new computer.
Push had been working correctly prior to the migration.
The problem was (duh) that I hadn't imported the profiles to the Xcode library on the new machine (in Organizer/Devices under Library->Provisioning Profiles).
The confusing part was that the DEVICE already had the right profiles and they showed up as expected in build settings, so everything looked correct there, but the XCode LIBRARY didn't have them, so it was signing the app with...???
This was what fixed it for me. (I had already tried toggling the capabilities on/off, recreating the provisioning profile, etc).
In the Build Settings tab, in Code Signing Entitlements, my .entitlements file wasn't link for all sections. Once I added it to the Any SDK section, the error was resolved.
I tried out all the answers listed here but no one solved my issue. In my case this error is due to my silly mistake in Appid creation. I used Wildcard App ID instead of using Explicit App ID caused the problem
If you want an application to receive remote notifications(push notification), then you need to use an Explicit App ID, such as com.tutsplus.push, instead of com.tutsplus.*
Please find the ScreenShot,
All you need to do is, add one key in .Entitlements File.
APS Environment this key needs to be added and value should be Developement or Production as per your purpose .
Kindly check uploaded image

Resources