3

I want to add Firestore to Flutter app, and I have problems running it on iOS. I already added this line to pubspec.yaml

cloud_firestore: ^0.6.3

Flutter is updated. Flutter doctor says that I have v0.3.1.

While compiling app for iOS simulator I got this build error

 Xcode's output: ↳     /
Users/*********/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.3/ios/Classes/FirebaseCorePlugin.m:7:9:
fatal error: 'Firebase/Firebase.h' file not found
    #import <Firebase/Firebase.h>
        ^~~~~~~~~~~~~~~~~~~~~


 1 error generated

I also run pod update to make sure that it is not issue with cocoapods.

UPDATE

After another research I found that deleting #use_frameworks! from Podfile in iOS folder let's project to compile. But what should be done in case when this can't be deleted?

2
  • Just to make sure, have you run flutter packages get and/or flutter packages upgrade? Commented May 2, 2018 at 0:38
  • @rmtmckenzie yes i did Commented May 2, 2018 at 6:50

1 Answer 1

6

The update to this gives me enough information to diagnose (hopefully). Flutter wasn't very good at supporting #use_frameworks & swift, but that was fixed fairly recently (mid-april 2018). However, it may not have made it to the beta channel yet at time of writing.

What was going on when #use_frameworks was set previously is that it wasn't linking everything into the right libraries, and a cocoapods bug was stopping it from finding certain files. The newest version of everything uses dynamic linking but has static_framework=true in the podfile for dependencies with static dependencies so that everything they need actually get linked into the right place.

This is fixed & tested on the master branch/channel, but should probably have made it to the dev branch/channel by now.

Here's the steps to makes sure your environment will support the fix, from this other github issue:

  • make sure you have Cocoapods 1.5.0 installed (pod --version should say >= 1.5.0)
  • change any dependencies you have on the firebase_xxx, google_sign_in, or cloud_firestore plugins to the newest versions (look for changelog entries referring to Cocoapods 1.5.0)
  • change your ios/Podfile to the newest version on Flutter master branch (https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/cocoapods)
  • delete ios/Podfile.lock and ios/Pods
  • switch to Flutter master (or dev) branch using flutter channel <branch>
  • flutter clean ; flutter run
Sign up to request clarification or add additional context in comments.

6 Comments

I've just tried this - I was really hoping it would work, but I'm still getting fatal error: 'firebase_core/FirebaseCorePlugin.h' file not found. Is there anything else I can try at all? This is infuriating!
@MikeCoverUps Have you found a solution for that?
Nope, sadly not. I've unfortunately not been able to pursue this any further as work has moved on, so this is left behind. One day I'll get back to is and hopefully flutter will be a bit more solid by then.
@rmtmckenzie Thank you. Is it documented somewhere because this looks like a common error and I wasted one day looking for a solution.
@shinriyo assuming you've tried all the steps in my answer, you might want to create a new question explaining your project and any particularities it might have, or at the very least give more explanation than did not work. There are many apps released with flutter and archiving does work. Your comment definitely doesn't give enough information for anyone to help you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.