我正在尝试在 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
Run Code Online (Sandbox Code Playgroud)
这是我运行时的结果 pod install
分析依赖项 Fetching podspec for
Flutterfrom.symlinks/flutter/ios-releaseFetching podspec forfirebase_messagingfrom.symlinks/plugins/firebase_messaging/iosFetching podspec forgeolocatorfrom.symlinks/plugins/geolocator/iosFetching podspec forgoogle_api_availabilityfrom.symlinks/plugins/google_api_availability/iosFetching podspec forimage_cropperfrom.symlinks/plugins/image_cropper/iosFetching podspec forimage_pickerfrom.symlinks/plugins/image_picker/iosFetching podspec forpackage_infofrom.symlinks/plugins/package_info/iosFetching podspec forpath_providerfrom.symlinks/plugins/path_provider/iosFetching podspec forpermission_handlerfrom.symlinks/plugins/permission_handler/iosFetching podspec forshared_preferencesfrom.symlinks/plugins/shared_preferences/iosFetching podspec forsqflitefrom.symlinks/plugins/sqflite/iosFetching podspec for from Fetchingwebview_flutter从.symlinks/plugins/webview_flutter/ios1)使用sqflite(0.0.1)使用webview_flutter(0.0.1)生成Pods项目集成客户端项目Pod安装完成!Podfile 中有 12 个依赖项,总共安装了 28 个 Pod。
我的 Xcode 版本是 10.0
我该如何解决?提前致谢
如有疑问,我只是擦除并重新安装,而不是手动处理级联依赖项。
1)rm你ios/Pods dir和 Podfile.lock 文件(当然要备份)
2)rm你的~/.pub-cache/hosted/pub.dartlang.org/
3) flutter clean
4) flutter packages get
5) pod repo update
6) 要么像往常一样运行 flutter 可执行文件(调用 pod install),要么手动运行pod install.
| 归档时间: |
|
| 查看次数: |
3203 次 |
| 最近记录: |