Dima Portenko
Dima Portenko

Reputation: 3844

Entitlements file was modified during the build, which is not supported

I'm getting following error during release build:

error: Entitlements file "projectname.entitlements" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements.

I can't find CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION on Google or Apple documentation, any ideas where should I use it?

Upvotes: 89

Views: 42976

Answers (7)

Tamlyn
Tamlyn

Reputation: 23544

If Clean build folder... doesn't work, try manually deleting all the untracked files in your repository. You can do this by doing a fresh git clone into a new folder, or doing git clean -fxd in your existing repo. But be warned this will DELETE ALL untracked files.

Upvotes: 1

cooperia
cooperia

Reputation: 1174

Like others have posted, this is resolved by cleaning the build folder or setting CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES.

However, after cleaning the build folder, one build will succeed but any subsequent ones will fail with the same entitlements error until you clean the build folder again. Obviously this isn't optimal since it adds ~2-3 minutes per build even for one line changes.

The second solution involving CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION does away with the entitlements error entirely but install on physical devices fails every other build until build folder is cleaned. Same outcome really.

Does anyone actually know why this is happening in the first place? I inspected my entitlements file before and after build.. Nothing is changing. Is this just an xcode bug that costs us all hours of our lives?

Upvotes: 0

C0L.PAN1C
C0L.PAN1C

Reputation: 12233

I've actually run into this EXACT same Compile-time error when I did the following in GitHub Client:

 **Discarded changes in my Git Repo for an entitlement file.**

enter image description here

It's imperative like suggested above, "Clean Build Folder" or add USER defined key CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES.

I know it's been answered above but I wanted to document the reproduction steps that led to the aforementioned error.

Upvotes: 0

Dima G
Dima G

Reputation: 2025

If Clean Build Folder doesn't help, make sure you don't have the same workspace/project opened in multiple Windows or Window Tabs!

(Xcode allows to open multiple tabs via File -> New -> Window Tab)

Upvotes: 2

mjl007
mjl007

Reputation: 775

Before you start modifying the build settings you can also try deleting the Derived data in your install or build directory.

If the project cache is found in the standard location below you can do an Xcode clean and it will get rid of this data.

/Users/your_user_name/Library/Developer/Xcode/DerivedData/Path_To_Project/

If you defined your own install or build paths then go to that specific directory and delete that cache. Xcode should provide you the path if that error happens.

Upvotes: 21

jameshfisher
jameshfisher

Reputation: 36399

I fixed this with Product > Clean Build Folder.

Upvotes: 237

jemise111
jemise111

Reputation: 415

Ran into the same issue. You can set CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION as a User-Defined setting in Build Setting.

  • In Xcode click on your project target and click Build Settings.
  • Click the "+" underneath Build Settings and then "Add User-Defined Setting"
  • Set CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION to YES for debug and release (or whatever schemes you like)

Screenshot of where to go in Xcode

Upvotes: 37

Related Questions