Flutter iOS构建时出现firebase_core模块非模块化头文件包含错误的解决问询
Flutter项目iOS端构建异常:框架模块包含非模块化头文件
在iOS设备(含模拟器)上运行Flutter项目时,触发框架模块内包含非模块化头文件的构建错误,具体情况如下:
构建日志详情
While building module 'firebase_core' imported from /Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5: In file included from <module-includes>:1: In file included from /Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13: In file included from /Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:11: /Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/admin/Desktop/Ali/GuestInMe/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module] #import <FirebaseCore/FirebaseCore.h> ^ 1 error generated. /Users/admin/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/ios/Classes/FLTFirebaseAuthPlugin.m:5:9: fatal error: could not build module 'firebase_core' #import <firebase_core/FLTFirebasePluginRegistry.h> ~~~~~~~^ 2 errors generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description Could not build the application for the simulator. Error launching application on iPhone 12 Pro Max.
已尝试的未生效解决操作
- 修改Xcode构建设置允许非模块化导入后,依次执行
flutter clean、在ios目录下运行pod install、再次执行flutter run,问题仍未解决 - 尝试将头文件访问级别从项目级调整为公开级,发现对应文件本身已经设置为公开属性
- 重新安装所有Pod依赖文件,报错始终指向
firebase_core.FLTFirebasePlugin,对应Xcode构建设置参考图:
请问该如何解决这个iOS端的构建报错问题?
内容的提问来源于stack exchange,提问作者Ali Solanki YouTuber
相关产品推荐
相关产品推荐

