Xcode报错:Entitlements file “SnapSlim.entitlements” was modified during the build, which is not supported.
Xcode报错:Entitlements file “SnapSlim.entitlements” was modified during the build, which is not supported.

Xcode报错:Entitlements file “SnapSlim.entitlements” was modified during the build, which is not supported.

问题描述

Xcode关闭并重新添加App Sandbox和Hardened Runtime后,运行程序时,Xcode会报错:

error: Entitlements file "SnapSlim.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.

错误信息表示

Xcode 在编译过程中检测到 SnapSlim.entitlements 文件被修改了,而这是不被允许的行为。

问题原因在于,我们改动App Sandbox和Hardened Runtime时,会动态更改 .entitlements 文件。

Xcode 要求 .entitlements 是静态不变的文件,以确保代码签名(Code Signing)能准确绑定权限。

解决方案

清理构建缓存:

或者手动清理:

rm -rf ~/Library/Developer/Xcode/DerivedData/*

清理构建缓存后,重新构建并运行应用,问题得到解决。

   

如果您认为这篇文章给您带来了帮助,您可以在此通过支付宝或者微信打赏网站开发者。

欢迎加入我们的 微信交流群QQ交流群,交流更多精彩内容!
微信交流群二维码 QQ交流群二维码

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注