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

XCode调试时控制台执行po命令失败,报错无法加载模块

解决M1 Pro设备上CocoaPods项目LLDB po命令报错问题

遇到LLDB执行po self时出现模块加载失败、共享Swift状态崩溃的问题,可按以下步骤逐一排查解决:

  • 清理项目与缓存

    • 执行Xcode的Product > Clean Build Folder(快捷键Cmd+Shift+K)
    • 找到DerivedData文件夹路径(Xcode > Settings > Locations),直接删除整个文件夹
    • 执行pod deintegrate移除现有pod集成,再用pod install重新安装,必要时加pod cache clean --all清空本地pod缓存
  • 调整CocoaPods架构适配

    • 在项目Podfile末尾添加以下配置,确保兼容M1芯片架构:
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'arm64 x86_64'
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
          end
        end
      end
      
    • 保存后重新执行pod install
  • 修改Xcode调试相关设置

    • 打开项目Build Settings,搜索Debug Information Format,确保Debug模式下设置为DWARF with dSYM File
    • 临时关闭Enable Swift Debugging:进入Edit Scheme > Run > Options,取消勾选该选项,重启Xcode后测试
  • 重置LLDB状态

    • 在Xcode调试控制台执行以下命令重置LLDB:
      expr -- @import UIKit
      expr -- reset
      
    • 或者直接重启Xcode和调试设备(模拟器/真机),彻底刷新LLDB的共享状态
  • 排查第三方Pods兼容性

    • 检查项目中是否有老旧Pods不支持M1架构,优先升级到最新版本
    • 若某个Pod无法升级,可在Podfile的post_install中单独给该Pod添加架构兼容配置,强制指定支持的架构

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.05 12:11:04