找不到'firebase_messaging / FirebaseMessagingPlugin.h'文件

时间:2019-09-04 10:39:20

标签: ios swift flutter

我正在尝试在ios上运行我的flutter应用,但我收到此错误

  

/ios/Runner/GeneratedPluginRegistrant.m:6:9:   找不到“ firebase_messaging / FirebaseMessagingPlugin.h”文件

这是我的Podfile内容

# Uncomment this line to define a global platform for your project
# platform :ios, '9.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 parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!
  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '4.1'
    end
  end
end

这是我运行pod install

时的结果
  

分析依赖关系从Flutter获取podspec   .symlinks/flutter/ios-release正在获取podspec   firebase_messaging中的.symlinks/plugins/firebase_messaging/ios   从geolocator获取podspec   .symlinks/plugins/geolocator/ios正在获取podspec   google_api_availability来自   .symlinks/plugins/google_api_availability/ios正在获取podspec   从image_cropper获取.symlinks/plugins/image_cropper/ios   image_picker.symlinks/plugins/image_picker/ios的podspec   从package_info获取podspec   .symlinks/plugins/package_info/ios正在获取podspec   从path_provider获取.symlinks/plugins/path_provider/ios   来自permission_handler的podspec   .symlinks/plugins/permission_handler/ios正在获取podspec   shared_preferences中的.symlinks/plugins/shared_preferences/ios   从sqflite获取.symlinks/plugins/sqflite/ios的podspec   从webview_flutter获取podspec   .symlinks/plugins/webview_flutter/ios下载依赖项使用   FMDB(2.7.5)使用Firebase(6.7.0)使用FirebaseAnalytics(6.1.1)   使用FirebaseAnalyticsInterop(1.4.0)使用FirebaseCore(6.2.1)   使用FirebaseCoreDiagnostics(1.0.1)使用   使用FirebaseInstanceID的FirebaseCoreDiagnosticsInterop(1.0.0)   (4.2.3)使用FirebaseMessaging(4.1.3)使用Flutter(1.0.0)使用   GoogleAppMeasurement(6.1.1)使用GoogleDataTransport(1.1.3)使用   GoogleDataTransportCCTSupport(1.0.2)使用GoogleUtilities(6.2.5)   使用Protobuf(3.9.0)使用TOCropViewController(2.5.1)使用   firebase_messaging(0.0.1)使用geolocator(3.0.1)使用   google_api_availability(2.0.1)使用image_cropper(0.0.1)使用   image_picker(0.0.1)使用nanopb(0.3.901)使用package_info(0.0.1)   使用path_provider(0.0.1)使用Permission_handler(3.2.2)使用   shared_preferences(0.0.1)使用sqflite(0.0.1)使用webview_flutter   (0.0.1)生成Pod项目集成客户端项目Pod   安装完成! Podfile和   共安装了28个吊舱。

我的Xcode版本是10.0

我该如何解决?预先感谢

3 个答案:

答案 0 :(得分:2)

有疑问时,我只是擦除并重新安装,而不是手动处理级联的依赖项。

1)c8 rm和Podfile.lock文件(当然要备份)

2)ios/Pods dir您的rm

3)~/.pub-cache/hosted/pub.dartlang.org/

4)flutter clean

5)flutter packages get

6)或者像往常一样运行flutter可执行文件(称为pod install),或者手动运行pod repo update

答案 1 :(得分:0)

我又几次遇到此错误(我记得)。 今天,我注意到我已经做了确切的修复:

cd ./ios
rm -R ../node_modules && ./Pods
yarn install
pod install

如果愿意,最好清理项目并关闭XCode-但是对我来说,上述步骤足以解决该问题。

答案 2 :(得分:0)

尝试启用位代码,因为某些框架仅在BITCODE启用时才能工作。

config.build_settings ['ENABLE_BITCODE'] ='是'