我已经跑了
flutter clean & flutter pub get
很多次 当我运行
flutter build ios
时,它会抱怨
/Users/john.z/Desktop/frontendRepos/flutter_alp_invoicing/ios/Runner/Runner-Bridg
ing-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
#import "GeneratedPluginRegistrant.h"
我从文件系统中搜索,它确实不存在。我认为它是由 flutter 自动创建的。但为什么不见了
我也多次运行以下命令
cd ios
pod install
此外,我的 Podfile 看起来像这样
# Uncomment this line to define a global platform for your project
platform :ios, '12.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!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Generated.xcconfig 文件总是在我运行
flutter build ios
后创建......这并不像我运行 flutter pub get
后文档所说的那样,有点混乱。
所以我需要先运行
flutter build ios
来生成Generated.xcconfig,然后我可以运行pod install。但是,GeneratePluginRegistrant.h 文件仍然丢失。
我还尝试重新创建 ios 文件夹
我上网查了,也问过chatgpt,还是不知道为什么。 有人可以帮助我吗?谢谢
我还是不知道为什么,但是我存储了GeneratedPluginRegistrant.m和GeneratedPluginRegistrant.h文件,只需将它们复制到ios/Runner下,然后就可以构建了...