You need to enable JavaScript to run this app. Xcode归档失败:Undefined symbol链接错误求助
优惠活动
大模型
产品
解决方案
定价
更多

Xcode归档失败:Undefined symbol链接错误求助

Unity集成Google Mobile Ads后Xcode归档出现Undefined symbol链接错误

问题详情

  • 异常现象:项目本地构建正常,集成Google Mobile Ads 9.5.0后,Xcode归档时触发以下链接错误:
    Undefined symbol: __swift_FORCE_LOAD_$_swift_Builtin_float
    Undefined symbol: __swift_FORCE_LOAD_$_swift_errno
    Undefined symbol: __swift_FORCE_LOAD_$_swift_math
    Undefined symbol: __swift_FORCE_LOAD_$_swift_signal
    Undefined symbol: __swift_FORCE_LOAD_$_swift_stdio
    Undefined symbol: __swift_FORCE_LOAD_$_swift_time
    Undefined symbol: __swift_FORCE_LOAD_$_swiftsys_time
    Undefined symbol: __swift_FORCE_LOAD_$_swiftunistd
    Linker command failed with exit code 1 (use -v to see invocation)
    
  • 当前环境:Unity 2022.3.28f1、Google Mobile Ads 9.5.0、Firebase 12.1.0、Applovin Max 13.0.1
  • 已尝试操作:删除Pods文件夹、Podfile.lock、xcworkspace后重新执行pod install,问题未解决。

解决方案

  • 启用Swift标准库嵌入
    打开Xcode项目Target的Build Settings,搜索Always Embed Swift Standard Libraries,将其设置为YES。同时确认Swift Language Version设置为5.0及以上版本。

  • 统一Pods的Swift版本
    在Podfile顶部添加以下配置,强制所有依赖Pods使用相同的Swift版本:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.0'
        end
      end
    end
    

    保存后重新执行pod install。

  • 调整链接器参数
    在Target的Build Settings中搜索Other Linker Flags,添加-ObjC和-lc++两个参数。同时检查Framework Search Paths,确保包含Google Mobile Ads、Firebase等所有依赖框架的路径。

  • 彻底清理缓存后重试
    按下Cmd + Shift + K清理项目,再按Cmd + Option + Shift + K清理构建文件夹,重启Xcode后重新执行归档操作。

  • 验证SDK版本兼容性
    检查Google Mobile Ads 9.5.0与Firebase 12.1.0、Applovin Max 13.0.1的版本适配性,可尝试降级Google Mobile Ads到9.4.0等稳定版本测试是否解决问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 00:48:16