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

Unity导出Xcode项目后出现大量Firebase未定义符号错误求助

Unity导出Xcode后iOS编译出现大量Firebase未定义符号错误

导出Unity项目至Xcode并尝试安装到iOS设备时,出现69个类似以下的未定义符号错误:

Undefined symbol: _Firebase_App_CSharp_FirebaseApp_GetApps

Undefined symbol: _Firebase_App_CSharp_FirebaseApp_RegisterLibrariesInternal

Undefined symbol: _Firebase_Auth_CSharp_AuthResult_AdditionalUserInfoInternal_get

Undefined symbol: _Firebase_Auth_CSharp_AuthResult_CredentialInternal_get

Undefined symbol: _Firebase_Auth_CSharp_AuthResult_UserInternal_get

Undefined symbol: _Firebase_Auth_CSharp_AuthResult_UserInternal_set

Undefined symbol: _Firebase_Auth_CSharp_FirebaseAuth_CreateUserWithEmailAndPasswordInternalAsync

Undefined symbol: _Firebase_Auth_CSharp_FirebaseAuth_CreateUserWithEmailAndPasswordInternalAsync_DEPRECATED

Undefined symbol: _Firebase_Auth_CSharp_FirebaseAuth_SignInAndRetrieveDataWithCredentialInternalAsync

已尝试添加GameKit.framework,问题未解决。

环境信息

  • Xcode版本:14.3.1 (14E300c)
  • Firebase Pod版本:曾尝试10.12.0、10.11.0、10.10.0
  • 最低iOS版本:12.0
  • Unity版本:2021.3.16
  • Firebase Unity SDK版本:11.1.0

当前Podfile内容

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'

target 'UnityFramework' do
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
  pod 'FirebaseAuth', '10.11.0'
  pod 'FirebaseCore', '10.11.0'
  pod 'FirebaseDatabase', '10.11.0'
  pod 'FirebaseStorage', '10.11.0'
end
target 'Unity-iPhone' do
end
use_frameworks!

解决步骤

1. 对齐Firebase版本匹配

Firebase Unity SDK 11.1.0对应的原生Pod版本应为10.15.0,你当前使用的10.11.0版本过低,版本不匹配会导致C#绑定的原生符号缺失。直接修改Podfile中Firebase相关版本为10.15.0。

2. 修复Podfile配置位置

将use_frameworks!移到platform声明下方,确保所有target都应用该配置:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'
use_frameworks!

target 'UnityFramework' do
  pod 'FBSDKCoreKit', '~> 16.0'
  pod 'FBSDKCoreKit_Basics', '~> 16.0'
  pod 'FBSDKGamingServicesKit', '~> 16.0'
  pod 'FBSDKLoginKit', '~> 16.0'
  pod 'FBSDKShareKit', '~> 16.0'
  pod 'FirebaseAuth', '10.15.0'
  pod 'FirebaseCore', '10.15.0'
  pod 'FirebaseDatabase', '10.15.0'
  pod 'FirebaseStorage', '10.15.0'
end
target 'Unity-iPhone' do
end

执行以下命令清理并重新安装Pods:

pod deintegrate
pod install

3. 检查Unity导出设置

  • 打开Unity Player Settings -> iOS -> Other Settings,设置Scripting Backend为IL2CPP(Firebase在iOS上推荐使用该后端)。
  • 确认Architecture选择ARM64(Xcode14+默认仅支持该架构,避免架构不匹配)。

4. 验证Firebase SDK导入完整性

  • 在Unity中重新导入Firebase Unity SDK,确保勾选Auth、Core、Database、Storage所有需要的模块,避免遗漏绑定文件。
  • 检查Unity项目中Assets/Plugins/iOS目录下是否存在Firebase相关的.framework文件和链接库。

5. Xcode项目配置检查

  • 选中UnityFramework target,进入Build Settings,确保Other Linker Flags包含-ObjC(Firebase需要该标志加载类别)。
  • 确认Framework Search Paths包含$(inherited)和Pods/Headers/Public,保证能找到Pod安装的框架。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.14 20:33:20