问题描述
我正在尝试为 iOS 构建。我刚刚更新到 Flutter v2 和所有 firebase 最新版本(截至 2021 年 5 月 18 日)。当前的 firebase 核心版本是 1.2.0 。但是,我遇到了这个错误
1 error generated.
/{my_user_path}/Developer/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.m:6:9: Fatal error: Could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
我之前没有意识到,我能够正常构建和部署。这是在 Flutter 和 firebase 更新之后最近的结果。
没有多少“Flutter clean”和删除 podfile.lock 的工作。
Xcode 输出:
Xcode's output:
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecut
or.m:158:12: warning: unused function 'processIsTranslated' [-Wunused-function]
static int processIsTranslated() {
^
1 warning generated.
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecut
or.m:158:12: warning: unused function 'processIsTranslated' [-Wunused-function]
static int processIsTranslated() {
^
1 warning generated.
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:41:29:
warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'NSInteger' (aka 'int')
[-Wshorten-64-to-32]
_bytesLoaded = progress.bytes_loaded();
~ ~~~~~~~~~^~~~~~~~~~~~~~
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:43:28:
warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'NSInteger' (aka 'int')
[-Wshorten-64-to-32]
_totalBytes = progress.total_bytes();
~ ~~~~~~~~~^~~~~~~~~~~~~
/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/FirebaseFirestore/Firestore/Source/API/FIRLoadBundleTask.mm:97:17:
warning: implicit conversion loses integer precision: 'firebase::firestore::api::LoadBundleTask::LoadBundleHandle' (aka
'long long') to 'FIRLoadBundleObserverHandle' (aka 'int') [-Wshorten-64-to-32]
return _task->Observe(std::move(core_observer));
~~~~~~ ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
While building module 'firebase_core' imported from
/Users/abdelrahman/Developer/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.m:6:
In file included from <module-includes>:1:
In file included from /Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/abdelrahman/Developer/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.2.0/ios/Classes/FLTFirebaseCorePl
ugin.h:11:
/Users/abdelrahman/Developer/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.2.0/ios/Classes/FLTFirebasePlugin
.h:9:9: error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
'/Users/abdelrahman/Desktop/bazaar_seller/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/abdelrahman/Developer/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-8.1.0/ios/Classes/FLTFirebaseSto
ragePlugin.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
Encountered error while building for device.
Firebase 版本:
cloud_firestore:2.2.0
firebase_auth: 1.2.0
firebase_core: 1.2.0
firebase_storage: 8.1.0
firebase_messaging:10.0.0
解决方法
当我升级到最新版本的 Flutter 和 Packages 时,我遇到了一些类似的情况。
在某些情况下,除了“flutter clean”之外,解决方案是修复 pub 缓存。
dart pub cache repair
对我有用的“序列”还有:
-
删除 Flutter.podspec (ios/Flutter/Flutter.podspec)
-
删除 podfile.lock
-
删除pod目录
-
dart pub cache repair
-
pod install
(或构建)
我遵循了这个答案,并在所有步骤之后将 flutter 更新到 v2.2.0。我相信我之前使用过 v2.0.6。 链接:Facing build issue after updating the flutter