Unity集成Firebase后Xcode打包Archive遇arm64符号缺失错误求助
Let’s walk through targeted fixes for the arm64 undefined symbols error you’re seeing when archiving your Unity-Firebase iOS app (without CocoaPods):
1. Confirm All Required Firebase Native Frameworks Are Included
Since you’re using Firebase’s C++ SDK (evidenced by libFirebaseCppApp.a and similar libraries), you must import the corresponding Objective-C Firebase frameworks to resolve these missing symbols:
- Add these frameworks to your Xcode project’s Frameworks, Libraries, and Embedded Content:
FirebaseApp.frameworkFirebaseAuth.frameworkFirebaseDatabase.framework- Ensure all Firebase frameworks are set to Embed & Sign (critical for linking during archive)
- Double-check that the version of these Objective-C frameworks exactly matches your Firebase Unity/C++ SDK version—version mismatches are a common cause of linking failures.
2. Validate Architecture Support for All Libraries
- Verify your imported Firebase frameworks support arm64:
Run this terminal command on each framework to check supported architectures:
Confirmlipo -info /path/to/your/FirebaseApp.framework/FirebaseApparm64is listed in the output. - Ensure Unity’s exported
libiPhone-lib.aalso supports arm64 (the warning about_unwind_testersuggests it does, but it’s worth confirming with the samelipocommand).
3. Fix Linker Flags and Search Paths
- In Xcode’s Build Settings:
- Add
-lc++to Other Linker Flags (Firebase’s C++ SDK depends on the C++ standard library, which is often omitted when manually linking). - If
-ObjCalone didn’t work, try adding-force_loadfor each Firebase C++ static library, e.g.:-force_load $(PROJECT_DIR)/Libraries/libFirebaseCppApp.a -force_load $(PROJECT_DIR)/Libraries/libFirebaseCppAuth.a - Confirm Framework Search Paths includes the directory where you stored your Firebase frameworks, with recursive search enabled (e.g.,
$(PROJECT_DIR)/FirebaseFrameworks/**).
- Add
4. Add Missing System Frameworks
Your error references _OBJC_CLASS_$_GKLocalPlayer—this means you need to add Apple’s GameKit.framework to your Xcode project (required for Firebase Game Center auth). Add it via Frameworks, Libraries, and Embedded Content.
5. Clean Build Cache and Rebuild
- Clear Xcode’s build cache: Go to
Product > Clean Build Folder(hold Option to see this option). - Delete your project’s Derived Data (find the path in Xcode’s
Preferences > Locations), then restart Xcode. - Test a regular build to a simulator or physical device first before attempting Archive—this can catch smaller linking issues before they block archiving.
6. Verify Unity Export Settings
- In Unity’s Player Settings (
Edit > Project Settings > Player > iOS):- Set Architecture to
ARM64(under Other Settings > Configuration). - Disable any app thinning or bitcode options temporarily (bitcode can sometimes interfere with manual framework linking).
- Set Architecture to
- Ensure your Firebase Unity SDK is up-to-date and compatible with the iOS frameworks you’re importing.
Final Check: Re-Download Firebase Frameworks
If all else fails, re-download the Firebase iOS SDK and Firebase C++ SDK for your target version. Manual imports can miss hidden dependency frameworks (like GoogleUtilities.framework or FirebaseCore.framework) that CocoaPods would handle automatically—ensure all nested dependencies are also added to your Xcode project.
内容的提问来源于stack exchange,提问作者Dor Dahan

