Xcode Entitlements (授权机制)

2021-03-29  本文已影响0人  大宝的爱情

Xcode Entitlements (授权机制)

操作系统有许多标准判断你的代码是否可以运行,比如 代码签名和沙盒

代码签名:代码签名保证了这个应用里所包含的内容正如它所说的那样不多不少

沙盒:限制了应用访问系统的资源

Entitlements决定了哪些系统资源在什么情况下允许被使用。简单的说他就是一个沙盒的配置列表(plist 文件格式)

Entitlements的使用:

在 Xcode 的 Capabilities 选项卡下选择一些选项之后,Xcode 就会生成这样一段 XML( .entitlements 文件)

.entitlements 文件文件可以在 Xcode build setting 中的 code signing entitlements 中设置路径。

注意:授权信息必须都在开发者中心的 App ID 中启用,并且包含在配置文件中

涉及问题:
The file "xxx.entitlements" could not be opened. Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "xxxxxx" and build configuration "debug" is correct and that the file exists on disk. (in target "xxxxxx")

有时候更换配置的时候会报出上述错误,解决办法:
打开项目,选择target中对应的项目target, 选择 Build Setting,在搜索中输入 enti 简写,然后找到 Signing 下的 Code Signing Entitlements 中的xxx/xxx.entitlements 修改成你app的名称,如:xxx/app名称.entitlements, 重新编译就可以了;或者你直接删掉 Signing 下的 Code Signing Entitlements 中的xxx/xxx.entitlements,然后重新编译也可以。

我解决的时候是直接删除,然后target----capacities----重新添加需要的权限。

参考原文1
参考原文2

上一篇下一篇

猜你喜欢

热点阅读