skip to Main Content

I have a flutter projecct. First it had to work on android and its working! Everything is cool. Time to make it work on iOS but I get the following error when I try to start the project on iOS Simulator:

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.

Sadly I did not find any working solution for this…

This is my pubspec.yaml (firebase dependencies):

  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

Answers


  1. this error is coming from .pub-cache so just flutter clean, if the error still persist delete all the .pub-cache then

    Remove the package from dependencies in pubspec.yaml, run flutter
    packages get. And then add the package to dependencies again and
    running flutter packages get.This process has solved the problem for
    me in the past.

    flutter clean

    and pub get

    Login or Signup to reply.
  2. In pubspec.yaml add firebase_core:any . Then run flutter clean , flutter pub get. Then navigate to iOS folder from the project root directory in terminal cd ios. Then run pod install. Now run flutter run and it should work as expected.

    Login or Signup to reply.
  3. What worked for me is using the precompiled version for the Firestore iOS SDK as something went wrong during compilation. See ‘Improve iOS Build Times’ section at https://firebase.flutter.dev/docs/overview/#initializing-flutterfire

    1. Remove all pod installations that have to do with firebase from your
      podfile (e.g. pod ‘Firebase/Analytics’).
    2. Add the precompiled pod to your podfile (see link above).

    I’ve added pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.7.0' to the runner target in the podfile (this is an older version as the newer also gave some error).

    The result looks like this in your podfile:

    target 'Runner' do
      use_frameworks!
      use_modular_headers!
      pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.7.0'
      flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    end``` 
    
    Login or Signup to reply.
  4. Remove ios/Pods folder.

    Remove Podfile and Podfile.lock

    Remove pubspec.lock

    Open terminal and run these commands one after another

    cd ios
    pod cache clean --all
    flutter clean
    flutter pub get
    pod install
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search