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

Flutter集成Firebase在Xcode编译报错:FirebaseMessaging.h未找到

Flutter集成Firebase时Xcode编译报错“FirebaseMessaging.h”未找到

我正在开发一个集成Firebase的Flutter项目,但在Xcode中编译时持续报错“FirebaseMessaging.h”未找到。

已确认FirebaseMessaging.h确实存在于项目目录中,路径为:
/Users/<username>/Desktop/MVP/<app_name>/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources

已尝试的解决方法

  • 删除Pods文件夹及Podfile.lock文件
  • 执行pod install
  • 卸载并重新安装Xcode
  • 验证Podfile配置正确
  • 更新Xcode中的"Header Search Paths"设置

已将/Users/<username>/Desktop/MVP/<app_name>/ios/Pods/FirebaseMessaging/FirebaseMessaging/Sources添加至Header Search Paths中。

Podfile内容

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'GoogleUtilities', '7.11.1'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

target 'ImageNotification' do
  use_frameworks!
  pod 'Firebase/Messaging'
  pod 'GoogleUtilities', '7.11.1'
end

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 23:44:53