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

Unity集成Firebase Auth构建iOS时Xcode因Bitcode问题失败

iOS构建Firebase Auth Google登录Bitcode错误解决指南

问题详情

集成Firebase Auth实现Google登录的iOS构建失败,Android端正常,Xcode抛出如下错误:

'/Library/Developer/Xcode/DerivedData/Unity-iPhone-gbwpuctwjyrotehhhhpzgerqcggr/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/PromisesObjC/FBLPromises.framework/FBLPromises(FBLPromise.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Library/Developer/Xcode/DerivedData/Unity-iPhone-gbwpuctwjyrotehhhhpzgerqcggr/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/PromisesObjC/FBLPromises.framework/FBLPromises' for architecture arm64

已尝试在Xcode构建设置中将ENABLE_BITCODE设为NO,但问题未解决。

使用版本信息:

  • Unity:2021.3.21
  • Firebase:11.3.0
  • Xcode:14.2

解决方案

1. 先在Unity端禁用Bitcode

Unity导出Xcode项目前,完成以下设置:

  • 打开Edit > Project Settings > Player,切换到iOS平台
  • 找到Other Settings > Configuration,将Enable Bitcode设为Disabled
  • 重新导出Xcode项目

2. 全局禁用Xcode所有Target的Bitcode

如果已经导出Xcode项目,需确保所有Target(包括依赖的Pods)都禁用Bitcode:

  • 打开Xcode项目,选中主Project节点,切换到Build Settings标签
  • 搜索ENABLE_BITCODE,检查所有Target(主App、Pods下的FBLPromises等)的Enable Bitcode是否为No
  • 若Pods中的Target无法直接修改,在项目的Podfile末尾添加以下代码,然后执行pod install:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ENABLE_BITCODE'] = 'NO'
        end
      end
    end
    

3. 清理缓存后重新构建

  • 在Xcode中执行Product > Clean Build Folder
  • 删除~/Library/Developer/Xcode/DerivedData下对应项目的缓存文件夹
  • 重新执行Archive或Build操作

4. 验证Firebase包兼容性

  • 卸载当前Firebase包,重新导入适配Unity 2021.3.x的Firebase Auth SDK
  • 检查Podfile.lock中FBLPromises的版本,确保与Firebase 11.3.0版本匹配

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 07:10:16