0
votes

I am trying to build for iOS. I just updated to flutter v2, and all firebase recent versions (as of May 18 2021). Current firebase core version is 1.2.0 . However, I am encountering this error

 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>

I didn't get that before, I was able to build and deploy ok. This is recent after the updates for both flutter and firebase.

No amount of 'flutter clean' and deleting the podfile.lock work.

Xcode output:

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 versions:

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

2

2 Answers

0
votes

I went through some situations like that when I upgraded to the newest version of flutter and packages.

In some cases the solution, besides "flutter clean", was to repair the pub cache.

dart pub cache repair

A "sequence" that worked for me was also:

  • Delete Flutter.podspec (ios/Flutter/Flutter.podspec)

  • Delete podfile.lock

  • Delete pod directory

  • dart pub cache repair

  • pod install (or build)

0
votes

I followed this answer with the addition to updating flutter to v2.2.0 after all the steps. I believe I was on v2.0.6 before. Link: Facing build issue after updating the flutter