You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下VS2022构建Xamarin.Forms iOS IPA签名失败求助

解决Xamarin.Forms iOS远程构建时"cannot find code object on disk"代码签名错误

问题场景

在Windows系统的Visual Studio 2022中使用Xamarin.Forms开发项目,将Remote Device设为目标平台生成Ad-Hoc IPA文件时,出现以下代码签名失败错误:

Severity    Code    Description Project File    Line    Suppression State
Error       Failed to codesign '/Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.mypro.App.iOS/453d74550fbc3f6c6544e031e2aae6db77e393d9ad1e4d70c67da4c28cd90e8b/bin/iPhone/Ad-Hoc/CPMYPROAppiOS.app': /Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.MYPRO.App.iOS/453d74550fbc3f6c6544e031e2aae6db77e393d9ad1e4d70c67da4c28cd90e8b/bin/iPhone/Ad-Hoc/CPMYPROAppiOS.app: cannot find code object on disk    CP.MYPRO.App.iOS            
Error       /usr/bin/codesign exited with code 1:
/Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.MYPRO
.App.iOS/453d74550fbc3f6c6544e031e2aae6db77e393d9ad1e4d70c67da4c28cd90e8b/bin/iPhone/Ad-Hoc/CPMYPROAppiOS.app: cannot find code object on disk  CP.MYPRO.App.iOS            

已确认Provisioning Profile配置正确,但错误仍存在。

解决方案

  • 清理远程Mac的Xamarin构建缓存
    远程Mac终端执行命令,删除对应项目的缓存文件夹,避免缓存损坏导致文件丢失:

    rm -rf /Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.MYPRO.App.iOS
    

    清理后重新触发构建。

  • 检查并调整项目输出路径
    右键iOS项目→属性→生成→输出,确保输出目录无特殊字符、路径长度不过长。过长路径可能导致Mac端文件系统无法识别目标文件。

  • 验证Mac端文件权限与签名工具状态

    1. 在Mac终端执行签名验证命令,获取更详细错误信息(替换为实际路径):
      codesign -v /Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.MYPRO.App.iOS/453d74550fbc3f6c6544e031e2aae6db77e393d9ad1e4d70c67da4c28cd90e8b/bin/iPhone/Ad-Hoc/CPMYPROAppiOS.app
      
    2. 确保当前用户对缓存文件夹有读写权限:
      chmod -R 755 /Users/dev1/Library/Caches/Xamarin/mtbs/builds/CP.MYPRO.App.iOS
      
  • 重新同步证书与Provisioning Profile

    • Windows端VS:工具→iOS→Provisioning Manager,刷新证书和Profile
    • Mac端Xcode:Preferences→Accounts,选中对应Apple ID后点击"Download Manual Profiles",确保两边的证书、Profile完全一致且未过期。
  • 核对Bundle Identifier一致性
    确认iOS项目属性中的Bundle Identifier与Provisioning Profile绑定的Identifier完全匹配(包括大小写),不匹配会导致签名时无法定位对应代码对象。

内容的提问来源于stack exchange,提问作者Manthiram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 19:37:51