我有一个升级到 .NET MAUI 的 Xamarin Forms 应用程序。 Visual Studio 识别配置文件(如果我打开下拉列表,我可以看到两个有效的,一个通配符和一个特定的 - 我已经尝试在这里手动选择正确的,但无济于事):
构建输出表明它也被识别了:
Target _DetectSigningIdentity:
Detected signing identity:
Code Signing Key: "Apple Development: Gerwin de Groot (<some id>)" (<some other id>)
Provisioning Profile: "Example (Debug)" (<some id>)
Bundle Id: com.example.test
App Id: <team id>.com.example.test
但部署到设备失败:
CopyingFile - Path: /Users/gerwin/Public/Projects/Example/bin/Debug/net6.0-ios/ios-arm64/Example.app/Poppins-MediumItalic.ttf
CopyingFile - PercentComplete: 99%
CreatingStagingDirectory - PercentComplete: 5%
ExtractingPackage - PercentComplete: 15%
InspectingPackage - PercentComplete: 20%
PreflightingApplication - PercentComplete: 30%
VerifyingApplication - PercentComplete: 40%
ApplicationVerificationFailed: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.0vKSvJ/extracted/Example.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)
error MT1006: Could not install the application '/Users/gerwin/Public/Projects/Example/bin/Debug/net6.0-ios/ios-arm64/Example.app' on the device 'Gerwin's iPhone 11': AMDeviceSecureInstallApplicationBundle returned: 0xe8008015.
Application could not be uploaded to the device.
它在 iPhone 上可见,但有一个空白的应用程序图标和一个云指示器:
点击它会给出错误信息
Unable To Install "Example"
This app cannot be installed because its integrity could not be verified.
如果我尝试使用命令行,我会得到类似的结果,例如与
dotnet build Example.csproj -c Debug -f net6.0-ios -t:Run -p:_DeviceName=<device UDID>
尽管令人惊讶, Release模式(-c Release
而不是 -c Debug
)有效(从命令行,而不是从 Visual Studio 本身,因为 another bug) .
我该如何解决这个问题?
最佳答案
这会很长。
首先,我必须输入我的 IOS 帐户,成为具有管理员权限(不确定是否可以使用更低权限)的团队的一员。
这是在工具 > 设置 > xamarin > AppleAccounts 中完成的。如果您在弹出窗口出现时不这样做。
在项目属性中,我必须选择自动配置并按照步骤操作。
理论上应该有:
- 添加证书。
- 添加标识符。
- 添加设备。
- 添加个人资料。
但是,它在第 2 步失败了。 所以我不得不去: https://developer.apple.com/account/resources/identifiers/list
并自己添加标识符。如果您的应用程序是 com.mycompany.myapp,请将其创建为:com.mycompany.*。
之后,我回到项目属性,再次尝试自动配置。
它检测到步骤 1 和 2 已完成,添加了设备,添加了配置文件,签名并成功部署。
(请记住,使用热重载进行调试不会处理应用程序图标、启动画面等...因此当您发现它们丢失时不要感到惊讶。)
时不时地我必须再次执行此过程,因为当我更新 VS 或 .NET 版本时,会发生无法解释的问题。
祝你好运。
关于ios - Visual Studio 不会在 Debug模式下将配置文件应用于 MAUI iOS 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75002906/