添加Analytics Pod后无法构建Objective-C模块Firebase,求解决方案
Hey there, I’ve dealt with this exact Firebase Analytics build issue a few times—let’s walk through some practical fixes to get your project running again:
Do a full Pod reinstall
Sometimes Pods get into a corrupted state. Close Xcode first, then run these commands in your project directory:pod deintegrate rm Podfile.lock pod installOnce done, open your
.xcworkspacefile (not the.xcodeproj) and try building again.Verify your Podfile configuration
Make sure your Podfile is set up correctly for Firebase. For most modern projects, this should work:platform :ios, '13.0' # Adjust to your project's minimum iOS version use_frameworks! :linkage => :static target 'YourAppTargetName' do pod 'Firebase/Analytics' endIf you’re using an older setup, try adding
use_modular_headers!instead of the static linkage line, then runpod installagain.Check Xcode Build Settings
Head to your target’s Build Settings and verify:Header Search Pathsincludes$(inherited)(this ensures Pods’ headers are picked up automatically)Build Active Architecture Onlyis set toNofor both Debug and Release (sometimes this causes missing headers during compilation)
Clean more than just DerivedData
Delete DerivedData as you did before, but also clean the Xcode build folder withCmd + Shift + K. For extra measure, run this terminal command to clear Xcode’s global cache:rm -rf ~/Library/Caches/com.apple.dt.XcodeRestart Xcode after doing this.
Confirm GoogleService-Info.plist is properly added
Make sure yourGoogleService-Info.plistfile is included in your app target:- Select the file in Xcode
- Check the "Target Membership" panel on the right—your app target should be checked
- Also verify it’s listed under your target’s
Build Phases > Copy Bundle Resources
Test with a fresh project
If none of the above works, create a brand new iOS project, add Firebase Analytics via Pods, and try building it. If that works, the issue is likely with your original project’s configuration (like conflicting build settings or outdated Xcode versions).
内容的提问来源于stack exchange,提问作者user9210345

