Flutterfire: Implemeting firestore throws the following error - fatal error: 'cloud_firestore/CloudFirestorePlugin.h' file not found

Created on 13 Oct 2019  ·  17Comments  ·  Source: FirebaseExtended/flutterfire

This is what I getting after compiling

Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    While building module 'Flutter' imported from /Users/jashan/Desktop/Programming/FlutterPgms/selfexplorer/ios/Runner/GeneratedPluginRegistrant.h:8:
    In file included from <module-includes>:1:
    In file included from /Users/jashan/Desktop/Programming/FlutterPgms/selfexplorer/ios/Flutter/Flutter.framework/Headers/Flutter.h:37:
    In file included from /Users/jashan/Desktop/Programming/FlutterPgms/selfexplorer/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h:11:
    /Users/jashan/Desktop/Programming/FlutterPgms/selfexplorer/ios/Flutter/Flutter.framework/Headers/FlutterPlugin.h:140:58: warning: this block declaration is not a prototype [-Wstrict-prototypes]
                          completionHandler:(nonnull void (^)())completionHandler;
                                                             ^
                                                              void
    1 warning generated.
    /Users/jashan/Desktop/Programming/FlutterPgms/selfexplorer/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'cloud_firestore/CloudFirestorePlugin.h' file not found
    #import <cloud_firestore/CloudFirestorePlugin.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning and 1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.

NOTE : I have done all possible solutions mentioned in various forums, like pod install, clean up and install, flutter upgrade, dependency etc. still am stuck here.

AppDelegate.Swift file is as follows

import UIKit
import Flutter
//import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
   // FirebaseApp.configure()
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

This is the aprt of pubspec.yaml, I have tried cloud_firestore without version, and also with ^0.3.0 results are same.

name: selfexplorer
description: A new Flutter project.

dependencies:
  cloud_firestore: ^0.2.6
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter
crowd bug

Most helpful comment

Same issue here.

  • Running the app in the iOS Simulator? Fine
  • Building the project? Fine
  • Try to archive the project from xCode? Fails with the stated error message

So far I've done all the troubleshooting I know:

  • Updating flutter
  • flutter clean
  • upgrade the cloud_firestore library to latest version (0.12.10)
  • delete pods from iOS project
  • recreating pods (pod init/pod install)

Same result, everything works fine in the simulator, but when trying to archive the project, it fails.
I've already ran out of ideas.

All 17 comments

@ghost

The issue at https://github.com/flutter/flutter/issues/18673 has been closed and moved here. Future collaboration on this issue will be done here.

So, is there any kind of progress on this? Considering that this bug (which I just now stumbled across myself) reared its ugly head more than a year ago it has been open for a very long time.

And I'm only seeing head-scratching by users, stumbling in the dark and not much in the way of actual progress or some hints on what logs/files/whatever to actually provide in order to solve this problem.

This, guys, is a showstopper.

same issue here using the latest version of the package

Same issue here.

  • Running the app in the iOS Simulator? Fine
  • Building the project? Fine
  • Try to archive the project from xCode? Fails with the stated error message

So far I've done all the troubleshooting I know:

  • Updating flutter
  • flutter clean
  • upgrade the cloud_firestore library to latest version (0.12.10)
  • delete pods from iOS project
  • recreating pods (pod init/pod install)

Same result, everything works fine in the simulator, but when trying to archive the project, it fails.
I've already ran out of ideas.

@Rhywden @diegodalbosco @delizondo

I'm trying to get clarification on what this issue is. Are you able to run the example app from this plugin?

Hey @kroikie I fixed the issue, I don't know what you are using an old version of the package cloud_firestore: ^0.2.6 , the latest version is 0.12.10.

I solved changing from:

platform :ios, '11.0'

to

platform :ios, '9.0'

In my PodFile.

@diegoveloper I'm glad this is working for you thanks for confirming. I'll keep this open in case others are still seeing this issue.

i had the same error, and uncomment platform :ios, '9.0' works for me, but first you should clean all data, flutter clean did not works for me

Reverting to cocoapods 1.7.5 solved the issue for me:
https://github.com/flutter/flutter/issues/41253#issuecomment-536039050

@kroikie @SamuelRioTz @diegoveloper can you please tell me about which file you are talking to change in the ios Package ?

Can you please specify the path and file ?

Thanks.

Hey @kroikie I fixed the issue, I don't know what you are using an old version of the package cloud_firestore: ^0.2.6 , the latest version is 0.12.10.

I solved changing from:

platform :ios, '11.0'

to

platform :ios, '9.0'

In my PodFile.

which podfile and path ?

@JayM96 ios/Podfile and also if you are using VScode you should close it and build using only the console, building using VScode it doesn't works

I had the similar issue. Tried all steps from https://github.com/flutter/flutter/issues/18673 and this post but didn't work for me.

However, finally I got it working today for me atleast.

Steps -

  1. flutter clean
  2. delete Podfile.lock from ios folder
  3. delete .flutter-plugins from root directory
  4. pod install (/ios)
  5. xcode > Product > create Archive

hope this helps.

Thanks for all the tips, but I still have the same issue.

Is there anybody with a clue why this is happening?
I am new to flutter as well so my knowledge is limited.

Thanks in advance.

1 - Delete Podfile.lock
2 - Delete Podfile
3 - Reinstall Pod
4 - Add the following lines to Podfile again from Firebase:

#add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
#add pods for any other desired Firebase products
#https://firebase.google.com/docs/ios/setup#available-pods

5 - Quit the IDE and Simulator.
6 - Launch the IDE again and rerun the program.

  1. Delete Podfile and Podfile.lock from ios folder
  2. Run flutter clean on your project root folder
  3. Build app -> flutter automatically generates a Podfile (building the app may take some time as it downloads required files from internet)
Was this page helpful?
0 / 5 - 0 ratings