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

添加Analytics Pod后无法构建Objective-C模块Firebase,求解决方案

Fixing "Could not build Objective-C module 'Firebase' / FirebaseAnalytics.h not found" Error

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 install
    

    Once done, open your .xcworkspace file (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'
    end
    

    If you’re using an older setup, try adding use_modular_headers! instead of the static linkage line, then run pod install again.

  • Check Xcode Build Settings
    Head to your target’s Build Settings and verify:

    • Header Search Paths includes $(inherited) (this ensures Pods’ headers are picked up automatically)
    • Build Active Architecture Only is set to No for 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 with Cmd + Shift + K. For extra measure, run this terminal command to clear Xcode’s global cache:

    rm -rf ~/Library/Caches/com.apple.dt.Xcode
    

    Restart Xcode after doing this.

  • Confirm GoogleService-Info.plist is properly added
    Make sure your GoogleService-Info.plist file is included in your app target:

    1. Select the file in Xcode
    2. Check the "Target Membership" panel on the right—your app target should be checked
    3. 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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 10:48:14