firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.74k stars 3.98k forks source link

[Update] Cloud Firestore Xcode Build Times #2751

Closed Salakar closed 2 years ago

Salakar commented 4 years ago

Hey everyone 👋

One of the key issues we wanted to look into providing a solution for was https://github.com/FirebaseExtended/flutterfire/issues/349 - improving build times for Xcode when using Firestore.

I'm happy to say we now have something for you to try (please provide feedback) that should significantly improve your build times;

Mac mini (2018) 6 cores:

Before:    ~ 240s
After:     ~  45s

GitHub Action CI 2 cores:

Before:    ~ 551s
After:     ~ 174s

Why is it slow?

Currently the Firestore iOS SDK depends on some 500k lines of mostly C++ code (from dependencies such as gRPC), which when compiling as part of your Xcode build can take a long time - even more so in CI environments.

How can we speed it up?

The biggest win to improving build times would be to not have to compile all that C++ code. The way to do that would be to consume precompiled binaries, in the new XCFramework bundle type introduced to Xcode last year, luckily as part of the Firebase iOS SDK release process these bundles are generated and published in a zip containing all Firebase SDKs.

To help you consume these quicker with the least amount of changes to your codebase we've created invertase/firestore-ios-sdk-frameworks - a repository that provides a drop in replacement podspec for Firestore that consumes the precompiled binaries instead, without you needing to download 3gb of SDKs and manually extract out the Firestore SDKs from the rest of the SDKs in the zip.

⚡ Setup ⚡

To integrate, you just need to add 1 line to your ios/Podfile inside your Flutter project;

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.4.0'

Add this line inside your target 'Runner' do block in your Podfile, e.g.:

# ...
target 'Runner' do
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.4.0'

# ...
end

No changes to the FlutterFire packages were required. See #4698 for a full example of integrating with automatic versioning based on what firebase_core uses.

Why not ship the binaries with the pub packages?

This would add ~200mb to every release. Whereas via a custom pod this is only ever downloaded once on your machine per Firebase iOS SDK version.


For more information on the pod and versioning please see the invertase/firestore-ios-sdk-frameworks repository.


⚠️ Note: if you were previously caching iOS builds on CI you may now find that when using precompiled binaries that caching is no longer required and it may actually slow down your build times by several minutes. See this comment below for more; https://github.com/FirebaseExtended/flutterfire/issues/2751#issuecomment-643190500


Please let me know if this has helped you, and I would love to see some before and after timings if you feel like sharing

mikehardy commented 4 years ago

This actually works for more than flutter, for react-native-firebase or anyone that integrates the firestore pod it works, I know this because my creaky old 4 core mbp takes about 5mins less to compile and get the app running. 1 line! Thank you.

Salakar commented 4 years ago

This actually works for more than flutter, for react-native-firebase or anyone that integrates the firestore pod it works, I know this because my creaky old 4 core mbp takes about 5mins less to compile and get the app running. 1 line! Thank you.

Yep, works for anyone using Firestore on iOS - no matter the framework 🎉

galvin59 commented 4 years ago

Thanks for the tip. However when I try to implement it, I get :

 [!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
      In snapshot (Podfile.lock):
        FirebaseFirestore (= 1.11.2, ~> 1.11.2)
      In Podfile:
        FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `6.26.0`)
    None of your spec sources contain a spec satisfying the dependencies: `FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `6.26.0`), FirebaseFirestore (= 1.11.2, ~> 1.11.2)`.
    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.

I tried to pod update, but with no luck

Any idea ?

Ehesp commented 4 years ago

@jsoms try removing your Podfile.lock and trying again.

orestesgaolin commented 4 years ago

I started simple tests on codemagic and there's at least few minutes decrease in iOS build time. Unfortunately cache upload caused the total build to be still rather long.

I'm going to update this table with next results.

Flutter stable 1.17.3 Xcode 11.5

Id Precompiled binaries Cache machine cloud_firestore version Firestore Fetch Installing dep iOS pod install Xcode build Total
40 🚫 (no_cache) no mini 0.13.4+2 6.23.0 0:00:04 0:01:43 0:30:50 278 793 0:49:34
41 🚫 (no_cache) no mini 0.13.4+2 6.23.0 0:00:04 0:01:09 0:26:10 212 755 0:45:10
251 🚫 (cache) yes mini 0.13.4+2 6.23.0 0:03:10 0:01:01 0:27:43 291 604 0:48:20
253 ✅ (cache) yes mini 0.13.4+2 6.23.0 0:04:28 0:01:27 0:16:17 193 402 0:42:00
254 ✅ (cache) yes mini 0.13.4+2 6.23.0 0:02:26 0:00:56 0:15:00 195 376 0:36:30
255 ✅ (cache) yes mini 0.13.4+2 6.23.0 0:04:01 0:01:17 0:14:55 201 424 0:41:33
1_no_cache ✅ (no_cache) no mini 0.13.4+2 6.23.0 0:00:05 0:01:09 0:13:29 165 404 0:25:52
2_no_cache ✅ (no_cache) no mini 0.13.4+2 6.23.0 0:00:18 0:01:27 0:14:43 169 478 0:26:06
3_no_cache ✅ (no_cache) no mini 0.13.4+2 6.23.0 00:00:07 00:02:15 00:17:04 220 463 00:30:20
4_no_cache_pro ✅ (no_cache_pro) no pro 0.13.4+2 6.23.0 00:00:02 00:00:57 00:09:27 141 273 00:17:21
5_no_cache ✅ (no_cache) no mini 0.13.4+2 6.23.0 00:00:05 00:01:11 00:12:39 136 366 00:23:52

image

1_no_cache is completely new workflow on codemagic without any cache but with precompiled binaries!

pro means that it was run on Mac Pro

Important remark when using cache the Android build is significantly shorter (eg 15 vs 9 min). Also cache usually takes 2 min to download and 4-6 min to create and upload.

Salakar commented 4 years ago

@orestesgaolin what's it like without uploading build caches?

orestesgaolin commented 4 years ago

@Salakar I updated my comment above and it's so surprising to see that without any cache (i.e. completely clean build on new workflow) the build time dropped dramatically to about 13 min. I'm gonna run it again without any cache

orestesgaolin commented 4 years ago

@Salakar second build without cache was a bit longer, so it seems that it doesn't have significant effect (thus it may be completely unnecessary to use). I will be collecting data in subsequent builds and maybe we can then draw some conclusions out of it

jmagman commented 4 years ago

Note using xcframeworks requires CocoaPods 1.9.0 or higher. Flutter currently requires a minimum of 1.6.

@Salakar Created issue to add cocoapods_version to the podspec. https://github.com/invertase/firestore-ios-sdk-frameworks/issues/1.

ElaineSchwner commented 4 years ago

Could you help me?

And I got this: [!] CocoaPods could not find compatible versions for pod "FirebaseFirestore": In Podfile: FirebaseFirestore (from https://github.com/invertase/firestore-ios-sdk-frameworks.git, tag 6.26.0)

cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
  Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
    FirebaseFirestore (~> 1.3.0)

What must I do? Thank you.

red42 commented 4 years ago

@ElaineSchwner I solved a similar problem with pod repo update as per @jsoms ' comment.

ElaineSchwner commented 4 years ago

pod repo update

Solved ! Thank you!

mafreud commented 4 years ago

It worked well. Thanks a lot 🛩️ 😄

RaviKavaiya commented 4 years ago

This didn't work for me. I tried pod install, pod update... See this:

Xcode build done.
Could not build the application for the simulator.
Error launching application on iPhone 11.
Ehesp commented 4 years ago

Hi @RaviKavaiya we'll need more information to help on that one. It looks like the XCode build succeeded but then fails when the app is launched - what are the errors?

RaviKavaiya commented 4 years ago

@Ehesp I tried running with flutter run -v. Couldn't find anything. Will give another shot later and will tell you..

Thanks

andre-arsenault commented 4 years ago

Build timings on my MacBook Pro (2018) 4 cores:

Before:   ~ 272s
After:    ~ 122s

A very nice speed improvement, thank you!

How can we tell which version of the iOS SDK the cloud_firestore package uses, so we can keep the tag up to date in our Podfile? I hope that will be part of the package's release notes going forward?

ghost commented 4 years ago

ld: library not found for -lBoringSSL-GRPC

I've raised an issue against the firestore-ios-sdk-frameworks library - referencing it here in case it helps someone else...

farukozsoy commented 4 years ago

On an old Macbook Pro ( 2011 - 2 cores - i7 )

before ~ 15 minutes after ~ 9 minutes

Thanks!

nilsreichardt commented 4 years ago

Is there also a workaround for Flutter macOS?

Salakar commented 4 years ago

@AndroidNils unfortunately this is only for iOS

deondejongh commented 4 years ago

Any ideas as to how to implement this suggested solution when one doesn't have access to a Mac? I'm using VSCode on Windows and Codemagic for builds, so not sure how to edit Podfile?

UPDATE: I selected an Android build on Codemagic to save build time, then opened Xcode via Codemagic's remote access, and pushed the podfile to my github repo which I was able to pull to my local Windows machine and edit as per the above solution. Seems to work. Thanks.

FindtheTreasure commented 4 years ago

After upgrading my pod Firestore to 6.26.0 and adding: pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0'

I now get a build fail on iOS: And whilst I've had the build time reduce from ~ 300 sec to 60 sec I can't reap the benefits because the build now fails :(

Launching lib/main.dart on Physical Device in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: NN79VAAAHJ
Xcode build done.                                           59.6s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-07-12 13:40:41.266 xcodebuild[35786:176593]  DTDeviceKit: deviceType from 474f57b3fe5c9111d35581001e340d5a17a26a57 was NULL
    2020-07-12 13:40:41.342 xcodebuild[35786:176689]  DTDeviceKit: deviceType from 474f57b3fe5c9111d35581001e340d5a17a26a57 was NULL
    ** BUILD FAILED **
Xcode's output:
↳
    error: the following command failed with exit code 0 but produced no further output
    CompileC /Users/garethbeall/Library/Developer/Xcode/DerivedData/Runner-ahiykwtkciugsrbkftajwoukgect/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/flutter_inapp_purchase.build/Objects-normal/arm64/FlutterInappPurchasePlugin.o /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    4 warnings generated.
    In file included from /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:2:
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:328:19: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param sharedStyle
     ~~~~~~~~~~~~~~~~~^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:25: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param allowTapToDismiss
     ~~~~~~~~~~~~~~~~~~~~~~~^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: warning: parameter 'allowTapToDismiss' not found in the function declaration [-Wdocumentation]
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: note: did you mean 'tapToDismissEnabled'?
     @param allowTapToDismiss
            ^~~~~~~~~~~~~~~~~
            tapToDismissEnabled
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
/Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
     @param queueEnabled
     ~~~~~~~~~~~~~~~~~~^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:19:23: warning: unused variable 'viewController' [-Wunused-variable]
        UIViewController *viewController =
                          ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:70:21: warning: unused variable 'topPadding' [-Wunused-variable]
                CGFloat topPadding = window.safeAreaInsets.top;
                        ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:71:21: warning: unused variable 'bottomPadding' [-Wunused-variable]
                CGFloat bottomPadding = window.safeAreaInsets.bottom;
                        ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:48:19: warning: unused variable 'size' [-Wunused-variable]
            NSNumber *size = call.arguments[@"size"];
                      ^
    8 warnings generated.
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:79:3: error: use of undeclared identifier 'FIRQuery'
      FIRQuery *query;
      ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:79:13: error: use of undeclared identifier 'query'
      FIRQuery *query;
                ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:81:5: error: use of undeclared identifier 'query'
        query = [getFirestore(arguments) collectionGroupWithID:arguments[@"path"]];
        ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:83:5: error: use of undeclared identifier 'query'
        query = [getFirestore(arguments) collectionWithPath:arguments[@"path"]];
        ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:90:5: error: use of undeclared identifier 'FIRFieldPath'
        FIRFieldPath *fieldPath = nil;
        ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:90:19: error: use of undeclared identifier 'fieldPath'
        FIRFieldPath *fieldPath = nil;
                      ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:96:38: error: use of undeclared identifier 'FIRFieldPath'
        } else if ([field isKindOfClass:[FIRFieldPath class]]) {
                                         ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:97:7: error: use of undeclared identifier 'fieldPath'; did you mean 'fieldName'?
          fieldPath = (FIRFieldPath *)field;
          ^~~~~~~~~
      fieldName
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:91:15: note: 'fieldName' declared here
        NSString *fieldName = nil;
                  ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:97:34: error: expected expression
          fieldPath = (FIRFieldPath *)field;
                                     ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:97:20: error: use of undeclared identifier 'FIRFieldPath'
          fieldPath = (FIRFieldPath *)field;
                       ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:106:9: error: use of undeclared identifier 'query'
            query = [query queryWhereField:fieldName isEqualTo:value];
            ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:106:18: error: use of undeclared identifier 'query'
            query = [query queryWhereField:fieldName isEqualTo:value];
                     ^
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:107:18: error: use of undeclared identifier 'fieldPath'; did you mean 'fieldName'?
          } else if (fieldPath != nil) {
                     ^~~~~~~~~
                     fieldName
    /Users/garethbeall/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/ios/Classes/FLTCloudFirestorePlugin.m:91:15: note: 'fieldName' declared here
        NSString *fieldName = nil;
                  ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Could not build the precompiled application for the device.

Error launching application on Physical Device.

Any help would be greatly appreciated.

I have tried:

AND Flutter doctor or Analyze weere both fine

sijangurung commented 4 years ago

Nice !!! Macbook pro 2,9 GHz Quad-Core Intel Core i7. 16 GB ram before: Xcode build done. 223.0s after: Xcode build done. 83.1s

for flutter -run 👍 💯 👍

Jman1080 commented 4 years ago

Tried with a new futter create app and the build fails with 20 errors

pubspec.yaml:

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^0.14.0

output:

Xcode build done.                                           32.2s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    In file included from /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:9:
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/Private/FLTFirebaseFirestoreUtils.h:42:4: error: expected a type
    + (FIRFirestoreSource)FIRFirestoreSourceFromArguments:(NSDictionary *_Nonnull)arguments;
       ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/Private/FLTFirebaseFirestoreUtils.h:44:4: error: expected a type
    + (FIRFirestore *_Nullable)getCachedFIRFirestoreInstanceForKey:(NSString *_Nonnull)key;
       ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/Private/FLTFirebaseFirestoreUtils.h:45:40: error: expected a type
    + (void)setCachedFIRFirestoreInstance:(FIRFirestore *_Nonnull)firestore
                                           ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:92:4: error: expected a type
    - (FIRFirestoreSettings *)FIRFirestoreSettings {
       ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:122:4: error: expected a type
    - (FIRQuery *)FIRQuery {
       ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:215:4: error: expected a type
    - (FIRFirestore *)FIRFirestore {
       ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:25:16: error: use of undeclared identifier 'FIRTimestamp'
          return [[FIRTimestamp alloc] initWithSeconds:seconds nanoseconds:nanoseconds];
                   ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:33:16: error: use of undeclared identifier 'FIRGeoPoint'
          return [[FIRGeoPoint alloc] initWithLatitude:latitude longitude:longitude];
                   ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:36:7: error: use of undeclared identifier 'FIRFirestore'
          FIRFirestore *firestore = [self readValue];
          ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:36:21: error: use of undeclared identifier 'firestore'
          FIRFirestore *firestore = [self readValue];
                        ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:38:15: error: use of undeclared identifier 'firestore'
          return [firestore documentWithPath:documentPath];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:47:16: error: use of undeclared identifier 'FIRFieldPath'
          return [[FIRFieldPath alloc] initWithFields:array];
                   ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:52:15: error: use of undeclared identifier 'FIRFieldValue'
          return [FIRFieldValue fieldValueForArrayUnion:[self readValue]];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:54:15: error: use of undeclared identifier 'FIRFieldValue'
          return [FIRFieldValue fieldValueForArrayRemove:[self readValue]];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:56:15: error: use of undeclared identifier 'FIRFieldValue'
          return [FIRFieldValue fieldValueForDelete];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:58:15: error: use of undeclared identifier 'FIRFieldValue'
          return [FIRFieldValue fieldValueForServerTimestamp];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:61:12: error: use of undeclared identifier 'FIRFieldValue'
              [FIRFieldValue fieldValueForDoubleIncrement:((NSNumber *)[self readValue]).doubleValue];
               ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:63:15: error: use of undeclared identifier 'FIRFieldValue'
          return [FIRFieldValue fieldValueForIntegerIncrement:((NSNumber *)[self readValue]).intValue];
                  ^
    /Users/jay/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/ios/Classes/FLTFirebaseFirestoreReader.m:65:15: error: use of undeclared identifier 'FIRFieldPath'
          return [FIRFieldPath documentID];
                  ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
rubenstolk commented 4 years ago

You'll need to do some cleaning: https://github.com/FirebaseExtended/flutterfire/issues/2507#issuecomment-625282792

esDotDev commented 4 years ago

Testing with a hello world w/ a bunch of plugins, using a 2 core Mac Mini as the builder. Before: 325s After 39s

This should really be called out on the front page. I didn't realize this was caused by firebase, and wasted a lot of time before finding this post tucked away.

With that said, thanks for the fix!!

Salakar commented 4 years ago

Testing with a hello world w/ a bunch of plugins, using a 2 core Mac Mini as the builder. Before: 325s After 39s

This should really be called out on the front page. I didn't realize this was caused by firebase, and wasted a lot of time before finding this post tucked away.

With that said, thanks for the fix!!

If you're willing @esDotDev, could you submit a PR to add it as an optional step for iOS here: https://firebase.flutter.dev/docs/firestore/overview

Theres an edit button on the bottom of every page on the docs site. 🤓

esDotDev commented 4 years ago

That's cool! I don't have time atm but I think we probably want to stick it here: https://firebase.flutter.dev/docs/installation/ios

I'm 2 days in just trying to get Firebase to run on iOS and about to pull my hair out :( Seems like quite the mess unfortunately.

esDotDev commented 4 years ago

Man at this point I just don't know what to do. So completely frustrated and at a wall with 2 days and no progress at all.

After a day trying to get my app to run, I'm now trying to just run the Counter App, with firebase_core and cloud_firestore, and it just refuses to work.

I've tried every version of Flutter, Stable, Beta, Master, multiple specific versions I've cleaned everything, so many times I've lost count, pub cache, Podfile, Pod lock, Pod Cache, you name it, I've deleted it I've built over 50 times, just will not compile with cloud_firestore I've tried both Swift and ObjC versions

dependencies:
  flutter:
    sdk: flutter

  cloud_firestore: ^0.14.0+2
  firebase_core: ^0.5.0

Always with these same errors:

 /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:20:5: error: unknown type name 'FIRTimestamp'; did you mean 'CVTimeStamp'?
        FIRTimestamp *timestamp = value;
        ^~~~~~~~~~~~
        CVTimeStamp
    In module 'UIKit' imported from /Users/home/Development/spikes/flutter_plugins_objc/ios/Pods/Target Support Files/cloud_firestore/cloud_firestore-prefix.pch:2:
    In module 'CoreImage' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIColor.h:13:
    In module 'CoreVideo' imported from
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:10:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h:309:3: note: 'CVTimeStamp'
    declared here
    } CVTimeStamp; 
      ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:20:31: error: implicit conversion of Objective-C pointer type 'id' to C
    pointer type 'CVTimeStamp *' requires a bridged cast
        FIRTimestamp *timestamp = value;
                                  ^~~~~
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:20:31: note: use __bridge to convert directly (no change in ownership)
        FIRTimestamp *timestamp = value;
                                  ^
                                  (__bridge CVTimeStamp *)( )
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:20:31: note: use CFBridgingRetain call to make an ARC object available as a
    +1 'CVTimeStamp *'
        FIRTimestamp *timestamp = value;
                                  ^
                                  CFBridgingRetain( )
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:20:19: warning: incompatible pointer types initializing 'CVTimeStamp *'
    with an expression of type '__strong id' [-Wincompatible-pointer-types]
        FIRTimestamp *timestamp = value;
                      ^           ~~~~~
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:21:31: error: member reference type 'CVTimeStamp *' is a pointer; did you
    mean to use '->'?
        SInt64 seconds = timestamp.seconds;
                         ~~~~~~~~~^
                                  ->
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:21:32: error: no member named 'seconds' in 'CVTimeStamp'
        SInt64 seconds = timestamp.seconds;
                         ~~~~~~~~~ ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:22:32: error: member reference type 'CVTimeStamp *' is a pointer; did you
    mean to use '->'?
        int nanoseconds = timestamp.nanoseconds;
                          ~~~~~~~~~^
                                   ->
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:22:33: error: no member named 'nanoseconds' in 'CVTimeStamp'
        int nanoseconds = timestamp.nanoseconds;
                          ~~~~~~~~~ ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:26:36: error: use of undeclared identifier 'FIRGeoPoint'
      } else if ([value isKindOfClass:[FIRGeoPoint class]]) {
                                       ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:27:5: error: use of undeclared identifier 'FIRGeoPoint'
        FIRGeoPoint *geoPoint = value;
        ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:27:18: error: use of undeclared identifier 'geoPoint'
        FIRGeoPoint *geoPoint = value;
                     ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:28:24: error: use of undeclared identifier 'geoPoint'
        Float64 latitude = geoPoint.latitude;
                           ^
    /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/Classes/FLTFirebaseFirestoreWriter.m:29:25: error: use of undeclared identifier 'geoPoint'
        Float64 longitude = geoPoint.longitude;
                            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    1 warning and 20 errors generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
PatrickVanRietschoten commented 4 years ago

For some reason, the proposed update to the Podfile would only work with CocoaPods 1.9.1 (and higher probably)

Not sure if it's related to the Podfile update or the used plugins itself, but leaving this here for people who are having a hard time to get this to work.

esDotDev commented 4 years ago

For some reason, the proposed update to the Podfile would only work with CocoaPods 1.9.1 (and higher probably)

Not sure if it's related to the Podfile update or the used plugins itself, but leaving this here for people who are having a hard time to get this to work.

It seems like this might have been the issue. You just saved me a ton of head to wall smashing, thanks a mill!

esDotDev commented 4 years ago

If you're willing @esDotDev, could you submit a PR to add it as an optional step for iOS here: https://firebase.flutter.dev/docs/firestore/overview

Thought it made more sense here so it can't get missed, and it's around the area we edit the podfile for other reasons. https://github.com/FirebaseExtended/flutterfire/pull/3365

nilsreichardt commented 4 years ago

@Salakar Is there any workaround for Flutter macOS? I opened a new issue for Flutter macOS and Cloud Firestore: #3185

esDotDev commented 4 years ago

Sorry, looks like I spoke to soon. When using the pre-compiled binary I get 2 errors.

When using firebase_core alone, it complains ld: framework not found BoringSSL-GRPC.xcframework

When using firebase_core plus cloud_firestore it blows up with random missing declaration errors, like: /Users/home/Development/_sdks/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0+2/ios/C lasses/FLTFirebaseFirestorePlugin.m:42:54: error: unknown type name 'FIRTransaction'; did you mean 'CATransaction'?

When removing the binary, and just trying to use firebase_core plus cloud_firestore I get like 300 lines about explaining some compatability matrix I couldn't possible begin to parse.

Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
    -> Fetching podspec for `cloud_firestore_web` from `.symlinks/plugins/cloud_firestore_web/ios`
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core_web` from `.symlinks/plugins/firebase_core_web/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only
      perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/6.31.0/Firebase.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_8_b_d.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.10.1/FirebaseCore.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/6.26.0/Firebase.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_0_9_f.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/0/9/f/FirebaseFirestore/1.17.0/FirebaseFirestore.podspec.json
      exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.7.2/FirebaseCore.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_0_8_4.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/8/4/GoogleUtilities/6.7.2/GoogleUtilities.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_8_9_c.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path:
      Specs/8/9/c/FirebaseCoreDiagnosticsInterop/1.2.0/FirebaseCoreDiagnosticsInterop.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_8_3_c.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path:
      Specs/8/3/c/FirebaseCoreDiagnostics/1.6.0/FirebaseCoreDiagnostics.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/9/f/FirebaseFirestore/1.15.0/FirebaseFirestore.podspec.json
      exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_4_2_7.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/4/2/7/FirebaseAuthInterop/1.1.0/FirebaseAuthInterop.podspec.json
      exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_3_8_6.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/1.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/3/8/6/abseil/0.20200225.0/abseil.podspec.json exists! Returning
      local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_c_8_7.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/c/8/7/gRPC-C++/1.31.0/gRPC-C++.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_a_d_a.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/a/d/a/leveldb-library/1.22/leveldb-library.podspec.json exists!
      Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_6_1_e.txt exists! Returning local because checking is
      only perfomed in repo update
      CDN: trunk Relative path: Specs/6/1/e/nanopb/1.30906.0/nanopb.podspec.json exists! Returning local
      because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/8/b/d/FirebaseCore/6.7.2/FirebaseCore.podspec.json exists! Returning
      local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "nanopb":
      In snapshot (Podfile.lock):
        nanopb (= 1.30906.0, ~> 1.30906.0)

      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.14.0-2, which
        depends on
          Firebase/Firestore (~> 6.26.0) was resolved to 6.26.0, which depends on
            FirebaseFirestore (~> 1.15.0) was resolved to 1.15.0, which depends on
              nanopb (~> 1.30905.0)

    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install
     --repo-update`.
     * changed the constraints of dependency `nanopb` inside your development pod `cloud_firestore`.
       You should run `pod update nanopb` to apply changes you've made.

    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in
    `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in
    unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:257:in
    `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:986:in `block in
    resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:984:in
    `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in
    resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform
    was specified. Please specify a platform for this target in your Podfile. See
    `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

pod repo update doesn't help.

esDotDev commented 4 years ago

Interestingly toasting the entire /ios folder and running create . , it now compiles and launches ok.

But I had just previously done that, and the only change I had made was to include the binary, and then remove it, which seems to have left the iOS install in a totally broken state. I did try all the obvious stuff like flutter clean, and deleting the pod lock, and cleaning the Xcode build, but didn't seem to help.

I will extremely carefully proceed from here... this whole thing is so brittle is pretty unsettling :/ I think I will look to avoid Firebase in the future as this just does not feel remotely robust, and I feel like I will be dealing with this in perpetuity everytime I go to work on my app on iOS.

I feel pretty mis-led by the whole bill of goods google sold about Firebase being a great cross-platform solution for Flutter. Ya, it works good on Android... iOS is a nightmare.

mikehardy commented 4 years ago

I know this is flutter and not react-native but I'm listening in on this issue because I help Invertase from time to time and the firestore pre-compiled framework is shared between FlutterFire and react-native-firebase

That said, if there is not some command line tooling to wipe out the various build caches and intermediate artifacts, someone in Flutter-land would earn lots of virtual beers by coding one up.

For reference / inspiration, this is the react-native-clean-project set of commands - all of which are needed at various times in order to truly reproduce clean builds. I run them all in CI for instance, and I never have bizarre problems, and the number of times I recommend it to users in react-native-firebase issues during triage and they then have success is quite high

https://github.com/pmadruga/react-native-clean-project/blob/master/source/internals/tasks.js

Cheers

lukas2 commented 4 years ago

This is great, thanks guys! I am using this with Cordova. Mentioning it explicitly so Cordova programmers will find it quicker. 😇

Salakar commented 4 years ago

This is great, thanks guys! I am using this with Cordova. Mentioning it explicitly so Cordova programmers will find it quicker. 😇

Great to hear this is benefitting other platforms too, so far Flutter, React Native & Cordova users reported using this with success :)

abdel-ships-it commented 4 years ago

Thank you so much! For me this meant a reduction from about ~ 45 minutes to 10 minutes on bitrise.

esDotDev commented 4 years ago

Has no one on the team been able to reproduce the issue with missing Type Declarations? I'm super hesitant to re-enable the binary as I have everything working properly, and previously it borked the project.

I think we do need a good clean script, Parsing the example from @mikehardy and the Cleanup Comment we need something like:

Am missing anything?

(killall Xcode || true) && xcrun -k && flutter clean && rm -rf $FLUTTER_ROOT/.pub-cache && rm -rf $HOME/Library/Caches/CocoaPods && rm -rf ios/Pods && rm -rf ios/build && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" && rm -rf ~/Library/Developer/Xcode/DerivedData/ && rm -rf ~/Library/Caches/com.apple.dt.Xcode/

esDotDev commented 4 years ago

Just tried adding the binary, same missing class exception errors, clean script doesn't seem to solve it :'(

mikehardy commented 4 years ago

The Xcode kill and simulator stop are needed (or...beneficial, the whole thing is a hack right? though it makes things 100% reproducible which is nice) because Xcode gets very upset when you delete the things those commands delete while it is still running, same with Simulator. So we get in front of that and just take them down.

nerder commented 4 years ago

Question: adding this will generate new files underios/build. This should be versioned or .gitignored ?

mikehardy commented 4 years ago

It is my understanding that nothing under ios/build should ever be versioned?

"build" implies (and is correct in this case) that they are derived/built from source, they are not themselves source. Nothing derived should be versioned?

karimone commented 4 years ago

Could someone help me with how to determine the correct tag version based on the packages I have? for example, I'm using:

  firebase_core: ^0.4.5
  firebase_auth: ^0.16.1
  firebase_storage: ^3.1.6
  firebase_messaging: ^6.0.16
  cloud_firestore: ^0.13.7

What version I should put in the runner?

sultanmyrza commented 4 years ago

Could someone help me with how to determine the correct tag version based on the packages I have? for example, I'm using:

  firebase_core: ^0.4.5
  firebase_auth: ^0.16.1
  firebase_storage: ^3.1.6
  firebase_messaging: ^6.0.16
  cloud_firestore: ^0.13.7

What version I should put in the runner?

Tested on fresh flutter project

When adding cloud_firestore: ^0.14.0+2 build time is normal. After adding cloud_firestore: ^0.14.0+2 build time 142 seconds

After adding code from snippet in podfile 1st build time 93 seconds 2nd build time 61.5 seconds 3rd build time 35.5 seconds

in my other old project that I didn't add code from snippet all build times around same duration longer than 150 seconds

@karimone In your case maybe you can try to update cloud_firestore to lates version and add snippet from in podfile read more at https://firebase.flutter.dev/docs/overview/#improve-ios-build-times

Snippet

# ...
target `Runner' do
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0'
# ...
end

I think only cloud_firestore slows down build time other firebase packages should not!

In the future if I will add other firebase package that will slow down build times I will update this comment but I think we only need to add pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0' and to know which version I would follow official docs https://firebase.flutter.dev/docs/overview/#improve-ios-build-times

sultanmyrza commented 4 years ago

@karimone if you don't know which version to set

first

flutter clean pod repo update deleted /ios/Pods/ and /ios/Podfile.lock

second

# ...
target `Runner' do
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'
# ...
end

Note: where the tag says 6.26.0 this should be changed to the pod version of Firebase/Firestore that you or your dependencies are using - in the format X.X.X, for FlutterFire the version that is being used can be seen here, for React Native Firebase here. If no version is specified on your current Firebase/Firestore pod then you can emit , :tag => '6.26.0' from the line above and use the latest version on master. you can read more here

3rd

flutter pub get

run pod install --verbose

--verbose flag is important because pod install take some time so to be sure you are not stuck and waiting for nothing it's always good to see what is doing pod install

jorg1piano commented 4 years ago

@AndroidNils unfortunately this is only for iOS

Is there a reason why the same solution only with a build for mac os wouldn't work? Long build times when introducing Firestore have been an issue for a really long time. I really like Firestore but spending hours building a project is not exactly cost effective. Any progress on this issue for macos?

nilsreichardt commented 4 years ago

Some context as to why this doesn't work for macOS: invertase/firestore-ios-sdk-frameworks#11 (comment

From https://github.com/FirebaseExtended/flutterfire/issues/3185