Xamarin 表单:找不到任何可用的 IOS 配置文件

问题描述

经过大量时间寻找解决我的问题的方法后,我向您寻求帮助。

当我尝试在我的 Xamarin Forms 项目中使用 SecureStorage 时,一切都在 android 上运行良好,但是当我在 IOS Simulator 上编译时,会出现一条错误消息:“添加记录时出错:MissingEntitlement”。

我找到了解决此错误的方法,我只是按照 Microsoft 文档进行操作:https://docs.microsoft.com/fr-fr/xamarin/essentials/secure-storage?tabs=ios

Keychain enable

Signature of bundle ios

现在,还有一条错误消息:找不到任何可用的 IOS 配置文件。

然后,我创建了一个 Apple Developer 帐户,转到我已安装的 Mac 并启动 Xcode,并将我的 Apple Developer 帐户连接到 Xcode。但错误在 Visual Studio for Windows 上仍然存在。

我已经尝试了我找到的所有解决方案,但没有任何效果。 我真的不知道该怎么办了。

解决方法

即使没有 Apple Dev 帐户,您也可以在 iOS 模拟器上使用 SecureStorage。为此,您需要与模拟器构建相关的有效权利。我在类似的回复 here 和官方 Microsoft docs 中描述了这一点:

  1. 修改您的自定义 Entitlements.plist 以包含钥匙串访问组:
<key>keychain-access-groups</key>
<array>
     <string>$(AppIdentifierPrefix)xxx.xxx.xxx</string>
</array>
  1. 将权利应用到项目设置中的 iOS 模拟器配置:

enter image description here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...