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

Xcode 14.3更新后打包报错:找不到__ObjC模块

Xcode 14.3 Archive 报错:no such module '__ObjC' 解决方案

经过大量调试确认,Xcode 14.3的编译器变更导致项目打包(Archive)时触发以下错误:

打包报错截图

错误日志详情:

/Users/shreeganesha/Library/Developer/Xcode/DerivedData/xxxxx-ccdlwtnmnbyewmdrzhbsqlqsqprc/Build/Intermediates.noindex/ArchiveIntermediates/xxxxxx/IntermediateBuildFilesPath/xxxxx/Release-iphoneos/xxxxx/Objects-normal/arm64/XXXX.private.swiftinterface:16:19: error: no such module '__ObjC'
@_exported import __ObjC
                  ^
/Users/shreeganesha/Library/Developer/Xcode/DerivedData/xxxxxx-ccdlwtnmnbyewmdrzhbsqlqsqprc/Build/Intermediates.noindex/ArchiveIntermediates/xxxxxx/IntermediateBuildFilesPath/mxxxxxxx.build/Release-iphoneos/xxxxxx.build/Objects-normal/arm64/xxxxxxxx.private.swiftinterface:1:1: error: failed to verify module interface of 'xxxxxxx' due to the errors above; the textual interface may be broken by project issues or a compiler bug
// swift-interface-format-version: 1.0

已尝试将IPHONEOS_DEPLOYMENT_TARGET更新至12.4,问题仍未解决。

以下是经过验证的可行解决方案:

  • 关闭"Build Libraries for Distribution"选项
    找到出现问题的Target,进入Build Settings面板,搜索Build Libraries for Distribution,将该选项设置为NO。该选项会生成.swiftinterface文件,Xcode 14.3在处理这类文件时存在兼容性问题,关闭后可绕过此错误。

  • 清理DerivedData并重新构建

    1. 完全关闭Xcode
    2. 删除DerivedData目录:执行终端命令 rm -rf ~/Library/Developer/Xcode/DerivedData
    3. 重新打开Xcode,按下Cmd+Shift+K清理构建文件夹,再尝试Archive操作
  • 检查并修复模块导入声明
    排查项目内的自定义模块或第三方依赖,若存在@_exported import __ObjC这类私有模块导入语句,将其替换为标准的import Foundation或import UIKit等公共模块导入,移除对私有__ObjC模块的引用。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 23:02:06