我有一个flutter projectt。首先它必须在android上工作,它的工作!一切都很酷。时间让它在iOS上工作,但我得到以下错误,当我试图在iOS模拟器上启动该项目:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 13,1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
While building module 'firebase_core' imported from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebaseCorePlugin.h:12:
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
--------------------------------- HERE --------------------------------
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:9: fatal error: could not build module 'firebase_core'
--------------------------------- HERE --------------------------------
#import <firebase_core/FLTFirebasePluginRegistry.h>
~~~~~~~^
2 errors generated.
While building module 'firebase_core' imported from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
In file included from /Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebaseCorePlugin.h:12:
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.8.0/ios/Classes/FLTFirebasePlugin.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin': '/Users/ew/Dev/projects/SWIE%20-%20ink%20-%20mobil/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/ew/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-10.0.6/ios/Classes/FLTFirebaseMessagingPlugin.m:6: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
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'Toast' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'FMDB' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'Reachability' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
遗憾的是,我没有找到任何工作的解决方案。
这是我的pubspec.yaml(firebase依赖项):
firebase_performance: ^0.7.0+7
firebase_crashlytics: ^2.1.1
firebase_core: any
firebase_messaging: ^10.0.6
flutter_local_notifications: ^8.1.1+2
4条答案
按热度按时间jvidinwx1#
删除ios/Pod文件夹。
删除Podfile和Podfile.lock
删除公共规范锁
打开终端,依次运行以下命令
cgyqldqp2#
这个错误是来自.pub-cache所以只是flutter clean,如果错误仍然存在删除所有.pub-cache然后
在pubspec.yaml中把这个包从依赖项中去掉,运行flutter packages get,然后再把这个包添加到依赖项中,运行flutter packages get,这个过程以前帮我解决了这个问题。
Flutter清理
和酒吧
6mw9ycah3#
在pubspec.yaml中添加
firebase_core:any
。然后运行flutter clean
、flutter pub get
。然后从终端cd ios
中的项目根目录导航到iOS文件夹。然后运行pod install
。现在运行flutter run
,它应该按照预期工作。dtcbnfnu4#
对我有用的是使用Firestore iOS SDK的预编译版本,因为在编译过程中出现了一些问题。https://firebase.flutter.dev/docs/overview/#initializing-flutterfire
1.从您的pod文件中删除所有与firebase有关的pod安装(例如pod“Firebase/Analytics”)。
1.将预编译的pod添加到你的podfile中(见上面的链接)。
我已经在podfile中添加了
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.7.0'
到runner目标(这是一个较旧的版本,因为较新的版本也给出了一些错误)。在您的播客文件中,结果如下所示: