重现步骤
预期行为
应用程序在 iOS 设备上构建、签名和调试。
实际行为
应用程序已构建,但在部署期间,部署窗口中输出以下错误,并且未安装应用程序:
ApplicationVerificationFailed:无法验证 /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.XhLS8d/extracted/App.iOS.app 的代码签名:0xe8008014(可执行文件包含无效签名。) 错误 MT1006:无法在设备“[此处的设备名称]”上安装应用程序“[此处是我的应用程序路径和名称]”:AMDeviceSecureInstallApplicationBundle 返回:##0xe8008014。
几个月前开发我的应用程序的先前版本时,在物理 iPhone 上的部署是有效的。
环境
适用于 Mac 的 Visual Studio 社区 2022 版本 17.6.3(内部版本 421)
运行时 .NET 7.0.3(64 位) 架构:X64 微软.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2
Apple 开发成果 Xcode:14.3.1 21815 版本:14E300c
Xamarin.iOS 版本:16.4.0.6 Visual Studio 社区 合成:97731c92c 分支:xcode14.3 构建日期 : 2023-04-11 22:38:36-0400
剥削制度 Mac OS X 13.4.1 Darwin 22.5.0 Darwin 内核版本 22.5.0 2023 年 6 月 8 日星期四 22:22:22(太平洋夏令时) 根目录:xnu-8796.121.3~7/RELEASE_X86_64 x86_64
我做了什么来修复它
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>Apple Development: </CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchLink>None</MtouchLink>
<MtouchInterpreter>-all</MtouchInterpreter>
<CodesignProvision>VS: XXX.XXXXX.XXXXXXXXX Development</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<RunWithWarnings>true</RunWithWarnings>
<CodesignExtraArgs></CodesignExtraArgs>
<MtouchUseThumb></MtouchUseThumb>
<IpaPackageName></IpaPackageName>
<CrashReportingApiKey></CrashReportingApiKey>
<EnableCodeSigning>True</EnableCodeSigning>
</PropertyGroup>
除了自动配置之外,还有两种方法来配置 iOS 设备。你可以尝试一下。
1.通过 XCode 免费配置 Xamarin.iOS 应用程序。如果您没有付费的Apple开发者帐户,您可以使用这种方式。
2.手动配置 Xamarin.iOS。这种方式不像自动配置那么方便,但我认为它更稳定。这样,您应该在Apple开发者门户生成一个新的配置文件,记住包含您要部署的设备。
有关更多信息,您可以参考Xamarin.iOS的设备配置。