Xamarin Forms iOS远程设备构建失败:代码签名及安装错误
Xamarin Forms远程iOS设备构建错误解决方案
问题现象
切换调试目标为Remote Device后,iOS构建触发以下错误:
Severity Code Description Project File Line Suppression State Error /usr/bin/codesign exited with code 1: /Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/App1.iOS.app: cannot find code object on disk App1.iOS Error Failed to codesign '/Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/App1.iOS.app': /Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/App1.iOS.app: cannot find code object on disk App1.iOS Error error MT1006: Could not install the application '/Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/App1.iOS.app' on the device 'iPhone X': AMDeviceSecureInstallApplicationBundle returned: 0xe800801c. 0
解决方案
1. 清理缓存并重建
- 删除Xamarin MTBS缓存目录:
/Users/dev1/Library/Caches/Xamarin/mtbs - 在Visual Studio中右键iOS项目,执行清理后再重新生成
- 重启Visual Studio和Mac构建主机
2. 修正构建配置与签名
- 远程调试需使用Debug配置而非Release:在项目属性中切换配置为Debug,平台选择iPhone
- 确认签名设置:选择匹配的开发者证书和Provisioning Profile,建议勾选自动管理签名(手动管理需确保Profile包含目标设备)
- 检查Mac主机上的开发者证书是否有效,未过期且已导入钥匙串
3. 验证设备连接与信任
- 在远程iPhone的设置 > 通用 > 设备管理中,信任你的开发者证书
- 通过Mac的Xcode > Window > Devices and Simulators确认设备已被正常识别
- 确保设备与Mac在同一网络,或通过USB直接连接(优先USB以避免网络不稳定问题)
4. 修复文件完整性与签名权限
- 在Mac终端中检查构建输出文件是否存在:
ls -la /Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/ - 若文件存在,手动尝试重新签名(替换证书名称为你的实际证书):
codesign -fs "你的开发者证书名称" /Users/dev1/Library/Caches/Xamarin/mtbs/builds/App1.iOS/3d1aacd9835662fd085314fe1e080b8972d0b6476a413276a2f319b1d3c77b30/bin/iPhone/Release/App1.iOS.app
5. 解决0xe800801c安装错误
- 检查设备剩余存储空间,确保有足够空间安装应用
- 重启远程iPhone设备,重新连接后再次尝试构建
- 若使用网络调试,切换为USB连接排除网络问题
内容的提问来源于stack exchange,提问作者Manthiram
相关产品推荐
相关产品推荐

