invertase / firestore-ios-sdk-frameworks

⚡ Precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK repository release downloads for faster build times.
Apache License 2.0
447 stars 49 forks source link

any version 10.17.0 or higher: Error (Xcode): Undefined symbol #79

Closed AliKales closed 8 months ago

AliKales commented 11 months ago

After updating cloud_firestore to 4.13.0 and 10.16.0 to 10.17.0 and error start to show up. Please check below

flutter run -v

flutter_run.txt

i tried flutter clean, removing Pods, podfile.lock PodFile then pod install --repo-update

my Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

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

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

flutter doctor -v


[✓] Flutter (Channel stable, 3.13.6, on macOS 13.4 22F66 darwin-arm64, locale tr-TR)
    • Flutter version 3.13.6 on channel stable at /Users/kales/Documents/code/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ead455963c (7 weeks ago), 2023-09-26 18:28:17 -0700
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/kales/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.84.2)
    • VS Code at /Users/kales/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android
      13 (API 33) (emulator)
    • iPhone 14 Pro (mobile)      • 418D3F60-17D4-487D-AEB2-21D42173165D • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS
      13.4 22F66 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google
      Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Long story short, after updating to 10.17.0 it doesnt want to work

ncooke3 commented 9 months ago

The result is different now. We get this error:

Lexical or Preprocessor Issue (Xcode): 'FirebaseFirestore/FirebaseFirestore.h' file not found
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FLTFirebaseFirestor>eExtension.h:3:8

How about importing <FirebaseFirestoreInternal/FirebaseFirestore.h> instead? Is it possible you could share a zip of the corresponding project? I'm wondering if the change in error means we got closer to a solution...

russellwheatley commented 9 months ago

@ncooke3 - I like to think we're getting closer!

It is imported already like:

<FirebaseFirestoreInternal/FirebaseFirestore.h>

but the error shows like this:

Lexical or Preprocessor Issue (Xcode): 'FirebaseFirestore/FirebaseFirestore.h' file not found

Here is a zip which demonstrates the error: frameworks_issue.zip

To reproduce, follow these steps:

  1. install Flutter on your machine if you don't have it
  2. Unzip and from root in terminal, run cd ios.
  3. run pod install
  4. run xed . to open workspace in Xcode.
  5. Run app against simulator
  6. You should see the exception in the build logs

Alternatively, if you don't wish to install Flutter on your machine, you could just create an iOS app, add core and performance to your Podfile, and for Firestore, add this line:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => "replicate-spm-strategy-18"

Then in AppDelegate, try to import:

#import <FirebaseFirestore/FirebaseFirestore.h>

Note that all header files are missing for Firestore pod. I think this is the key. I'm just not sure why they aren't included 🤔

ncooke3 commented 9 months ago

Note that all header files are missing for Firestore pod. I think this is the key. I'm just not sure why they aren't included 🤔

Thanks for the instructions. I had a look, but don't know why they are missing. I agree that this might be the crux to solving it. Despite the podspec in your branch pointing to the firebase-ios-sdk repo, the paths used within the podspec seem to be relative to this repo. For example, the s.source_files glob does not get pulled down when installing the pod, but the s.resource line does. This must mean that the paths are for some reason being evaluated as relative to the podspec rather that relative to the root of the firebase-ios-sdk?

I was suspicious that using vendored_frameworks and source_files within the same podspec may be the issue, so I split them up in a branch of mine and didn't see any change in behavior.

ueman commented 9 months ago

Is that maybe due to the Flutter symlinking of CocoaPods?

russellwheatley commented 9 months ago

@ncooke3 - Something odd is occurring, I essentially copy and pasted the FirebaseFirestore.podspec: https://github.com/firebase/firebase-ios-sdk/blob/main/FirebaseFirestore.podspec

Into the firestore-ios-sdk-frameworks podspec: https://github.com/invertase/firestore-ios-sdk-frameworks/compare/main...replicate-spm-strategy-18

I only changed the summary, description, author & homepage properties which shouldn't impact anything. It still didn't pull in any of the source/header files on these paths into the FirebaseFirestore pod:

main...replicate-spm-strategy-18#diff-722406d904 main...replicate-spm-strategy-18#diff-722406d904

However, when I use the following in our cloud_firestore.podspec here:

s.dependency 'Firebase/Firestore', '10.19.0'

You can see all those source and header files in the FirebaseFirestore pod:

Screenshot 2024-01-16 at 16 09 57

So there is a difference between the two and I'm not sure what that could be 🤔

russellwheatley commented 9 months ago

Is that maybe due to the Flutter symlinking of CocoaPods?

@ueman - I tried on a pure iOS app and I got the same results which eliminates Flutter as a suspect I think.

paulb777 commented 9 months ago

One problem with the podspec in the branch above is mixing source and binaries in the same podspec. A better approach might be to rename the current Invertase FirebaseFirestore.podspec to FirebaseFirestoreInternal.podspec and then make a new FirebaseFirestore.podspec that matches Firebase's SPM rule, including Firestore's header mappings from FirebaseFirestoreInternal and depends on the new Invertase FirebaseFirestoreInternal.podspec. I'll see if I can find some time to experiment with this sometime in the next week.

paulb777 commented 9 months ago

I have a draft solution in #88 and would appreciate if others would try it out.

russellwheatley commented 9 months ago

Thanks for looking into this issue, @paulb777, much appreciated. I tried out your solution, it built fine but it didn't reduce the build time as intended.

To clarify what occurs; We pull in the Firestore dependency in the FlutterFire cloud_firestore.podspec here: https://github.com/firebase/flutterfire/blob/master/packages/cloud_firestore/cloud_firestore/ios/cloud_firestore.podspec#L36

which would pull in the cocoapods sources (i.e including FirebaseFirestoreInternal). We use firestore-ios-sdk-frameworks to override that pod by updating the Podfile with the following:

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

Instead, that pulls in all FirebaseFirestore xcframeworks which reduces build times.

With what you've outlined in the PR description, it won't override the FirebaseFirestore pod. At build time, I think, it will continue to build FirebaseFirestoreInternal from source.

I updated the Podfile in my Flutter project ios/Podfile with the following:

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  pod 'FirebaseFirestoreBinary', '10.18.0'
end

and my build time was still around 4-5 minutes. I might be mistaken but I think whatever solution would need to override the pod FirebaseFirestore. Apologies if I have misunderstood something.

paulb777 commented 9 months ago

@russellwheatley Thanks for checking. I added the FirebaseFirestore override back in the PR.

Try replacing pod 'FirebaseFirestoreBinary', '10.18.0' with pod 'FirebaseFirestore', :git => 'https://github.com/paulb777/firestore-ios-sdk-frameworks.git', :tag => '10.18.0' in the Podfile.

russellwheatley commented 9 months ago

@paulb777 - I wonder if we're getting closer. The build cycle on Xcode has what I would expect when using firestore-ios-sdk-frameworks. Usually when importing it roughly has 1200-1400 components to build (as opposed to around 6000 when you use Firestore without firestore-ios-sdk-frameworks):

Screenshot 2024-01-23 at 09 23 36

We still get the same build error:

Screenshot 2024-01-23 at 09 24 10

Looking through the Pods, I see that the relevant header files are present (including FirebaseFirestore.h), but they are in the FirebaseFirestoreBinary Pod:

Screenshot 2024-01-23 at 09 24 31

The FirebaseFirestore Pod only contains a Support Files directory:

Screenshot 2024-01-23 at 09 25 56

I did try and change the import for the build error to:

#import <FirebaseFirestoreBinary/FirebaseFirestore.h>

But the FirebaseFirestoreBinary is not available as a directory to import from.

I wonder whether it is possible to include the header files in FirebaseFirestore instead?

paulb777 commented 9 months ago

@russellwheatley

Do you see the same error in the Xcode build log?

These are the lines that fixed that import issue in my test: https://github.com/paulb777/firestore-ios-sdk-frameworks/blob/binary-prototype/FirebaseFirestoreBinary.podspec#L20-L21.

russellwheatley commented 9 months ago

@paulb777 - Here are the errors from the build logs:

In file included from /Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m:5:
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:13:4: error: expected a type
+ (FIRQuery *)parseQueryWithParameters:(nonnull PigeonQueryParameters *)parameters
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:14:49: error: expected a type
                             firestore:(nonnull FIRFirestore *)firestore
                                                ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:17:4: error: expected a type
+ (FIRFilter *_Nonnull)filterFromJson:(NSDictionary<NSString *, id> *_Nullable)map;
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:18:4: error: expected a type
+ (FIRFirestoreSource)parseSource:(Source)source;
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:19:4: error: expected a type
+ (FIRServerTimestampBehavior)parseServerTimestampBehavior:
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:21:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (PigeonDocumentSnapshot *)toPigeonDocumentSnapshot:(FIRDocumentSnapshot *)documentSnapshot
                          ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:21:27: note: insert '_Nullable' if the pointer may be null
+ (PigeonDocumentSnapshot *)toPigeonDocumentSnapshot:(FIRDocumentSnapshot *)documentSnapshot
                          ^
                           _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:21:27: note: insert '_Nonnull' if the pointer should never be null
+ (PigeonDocumentSnapshot *)toPigeonDocumentSnapshot:(FIRDocumentSnapshot *)documentSnapshot
                          ^
                           _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:21:55: error: expected a type
+ (PigeonDocumentSnapshot *)toPigeonDocumentSnapshot:(FIRDocumentSnapshot *)documentSnapshot
                                                      ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:23:35: error: expected a type
                                 (FIRServerTimestampBehavior)serverTimestampBehavior;
                                  ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:24:24: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (PigeonQuerySnapshot *)toPigeonQuerySnapshot:(FIRQuerySnapshot *)querySnaphot
                       ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:24:24: note: insert '_Nullable' if the pointer may be null
+ (PigeonQuerySnapshot *)toPigeonQuerySnapshot:(FIRQuerySnapshot *)querySnaphot
                       ^
                        _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:24:24: note: insert '_Nonnull' if the pointer should never be null
+ (PigeonQuerySnapshot *)toPigeonQuerySnapshot:(FIRQuerySnapshot *)querySnaphot
                       ^
                        _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:24:49: error: expected a type
+ (PigeonQuerySnapshot *)toPigeonQuerySnapshot:(FIRQuerySnapshot *)querySnaphot
                                                ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:25:49: error: expected a type
                       serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior;
                                                ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:26:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (NSArray<PigeonDocumentChange *> *)
                                   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:26:36: note: insert '_Nullable' if the pointer may be null
+ (NSArray<PigeonDocumentChange *> *)
                                   ^
                                    _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:26:36: note: insert '_Nonnull' if the pointer should never be null
+ (NSArray<PigeonDocumentChange *> *)
                                   ^
                                    _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:27:38: error: unknown type name 'FIRDocumentChange'
    toPigeonDocumentChanges:(NSArray<FIRDocumentChange *> *)documentChanges
                                     ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:27:59: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
    toPigeonDocumentChanges:(NSArray<FIRDocumentChange *> *)documentChanges
                                                          ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:27:59: note: insert '_Nullable' if the pointer may be null
    toPigeonDocumentChanges:(NSArray<FIRDocumentChange *> *)documentChanges
                                                          ^
                                                           _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:27:59: note: insert '_Nonnull' if the pointer should never be null
    toPigeonDocumentChanges:(NSArray<FIRDocumentChange *> *)documentChanges
                                                          ^
                                                           _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:28:30: error: expected a type
    serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior;
                             ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:29:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (PigeonDocumentChange *)toPigeonDocumentChange:(FIRDocumentChange *)documentChange
                        ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:29:25: note: insert '_Nullable' if the pointer may be null
+ (PigeonDocumentChange *)toPigeonDocumentChange:(FIRDocumentChange *)documentChange
                        ^
                         _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:29:25: note: insert '_Nonnull' if the pointer should never be null
+ (PigeonDocumentChange *)toPigeonDocumentChange:(FIRDocumentChange *)documentChange
                        ^
                         _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:29:51: error: expected a type
+ (PigeonDocumentChange *)toPigeonDocumentChange:(FIRDocumentChange *)documentChange
                                                  ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:31:31: error: expected a type
                             (FIRServerTimestampBehavior)serverTimestampBehavior;
                              ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:32:27: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (PigeonSnapshotMetadata *)toPigeonSnapshotMetadata:(FIRSnapshotMetadata *)snapshotMetadata;
                          ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:32:27: note: insert '_Nullable' if the pointer may be null
+ (PigeonSnapshotMetadata *)toPigeonSnapshotMetadata:(FIRSnapshotMetadata *)snapshotMetadata;
                          ^
                           _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:32:27: note: insert '_Nonnull' if the pointer should never be null
+ (PigeonSnapshotMetadata *)toPigeonSnapshotMetadata:(FIRSnapshotMetadata *)snapshotMetadata;
                          ^
                           _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:32:55: error: expected a type
+ (PigeonSnapshotMetadata *)toPigeonSnapshotMetadata:(FIRSnapshotMetadata *)snapshotMetadata;
                                                      ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:33:51: error: expected a type
+ (DocumentChangeType)toPigeonDocumentChangeType:(FIRDocumentChangeType)documentChangeType;
                                                  ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:12: error: unknown type name 'FIRFieldPath'
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
           ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:28: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                           ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:28: note: insert '_Nullable' if the pointer may be null
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                           ^
                            _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:28: note: insert '_Nonnull' if the pointer should never be null
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                           ^
                            _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:77: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                                                                            ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:77: note: insert '_Nullable' if the pointer may be null
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                                                                            ^
                                                                             _Nullable
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/Private/FirestorePigeonParser.h:34:77: note: insert '_Nonnull' if the pointer should never be null
+ (NSArray<FIRFieldPath *> *)parseFieldPath:(NSArray<NSArray<NSString *> *> *)fieldPaths;
                                                                            ^
                                                                             _Nonnull
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m:10:4: error: expected a type
+ (FIRFilter *_Nonnull)filterFromJson:(NSDictionary<NSString *, id> *_Nullable)map {
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m:63:4: error: expected a type
+ (FIRQuery *)parseQueryWithParameters:(nonnull PigeonQueryParameters *)parameters
   ^
/Users/russellwheatley/projects/flutterfire/packages/cloud_firestore/cloud_firestore/ios/Classes/FirestorePigeonParser.m:64:49: error: expected a type
                             firestore:(nonnull FIRFirestore *)firestore
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
8 warnings and 20 errors generated.

I think this is a result of the same error mentioned above, the header files are not being recognised 🤔. That particular error mentioned above is missing from the logs but it is displayed in the left hand panel:

Screenshot 2024-01-23 at 16 25 28
paulb777 commented 9 months ago

@russellwheatley Following the flutter repro instructions above with the addition of two commands flutter pub get and pod cache FirebaseFirestore, the following Podfile generates an Xcode workspace that successfully builds for me:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

$FirebaseSDKVersion = '10.18.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
  pod 'FirebaseFirestore', :git => 'https://github.com/paulb777/firestore-ios-sdk-frameworks.git', :tag => "10.18.0"
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
russellwheatley commented 9 months ago

@paulb777 - did you also include performance and/or real-time database? The problem stems when you also include those plugins along with firestore as they also include FirebaseSharedSwift which caused the initial build error.

If you haven't, this command pulls in those dependencies if you run from the flutter project root:

flutter pub add firebase_core cloud_firestore firebase_performance

Also run pod install from the flutter_project_root/ios directory and you should be able to build from Xcode.

paulb777 commented 9 months ago

Yes. I confirmed it still builds after adding pod 'FirebasePerformance' to the Podfile.

With the new design, all Swift is built as source, so there should no longer be a conflict. Also, leveldb is always built as source, so the leveldb workaround for RTDB is no longer needed.

lukemmtt commented 9 months ago

@paulb777 's approach in https://github.com/invertase/firestore-ios-sdk-frameworks/pull/88#issuecomment-1906994215 resolves this issue for me. Thank you Paul!

matt-hall-zory commented 9 months ago

As I commented in the Pull Request, this also resolved the issue for me. Thank you again Paul. Looking forward to the merge.

russellwheatley commented 9 months ago

@paulb777 - I was able to successfully build once I created a new Flutter project 🎉 . Thanks for the work.

To everyone else paying attention to this issue, we should hopefully get this resolved in the near future. It's not quite as simple as merging Paul's PR, but we will endeavour to get this working as soon as possible . I will let you know when it is working 🙏

ulusoyca commented 9 months ago

I am still having the same error. What am I missing?

  cloud_firestore: ^4.14.0
  firebase_auth: ^4.16.0
  firebase_core: ^2.24.2
  firebase_crashlytics: ^3.4.9

This is my podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git'
source 'https://cdn.cocoapods.org/'

target 'Runner' do
  use_frameworks!
  pod 'FirebaseFirestore', :git => 'https://github.com/paulb777/firestore-ios-sdk-frameworks.git', :tag => '10.18.0'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
    end
  end
end
image
lukepighetti commented 9 months ago

Used to be these frameworks were available within 48 hours (iirc) of a new release. But this one has been broken for me for almost three months. Did something change upstream? It's a very painful developer experience right now.

We were able to pin to firebase_core: 2.21.0 for a few months but now it's being left behind by other dependencies like firebase_auth

matt-hall-zory commented 9 months ago

I saw that Paul's PR was closed without any further info? Is there any update on this?

mikehardy commented 9 months ago

@matt-hall-zory I believe this is still a very active current work area - I don't have specific info to share but at least I personally am interested in fixing it (I love ccache, yes, but I want this to work too). And I'm pretty sure Mike D and Russell and Paul B are all working on it

Usually when Mike D closes stuff it's because he just went and fixed everything, so I have my fingers crossed for that.

@lukepighetti these are built by a scheduled job and they come out just a few hours after upstream firebase-ios-sdk releases things. 10.20.0 was released just recently for instance, on schedule. What you're seeing is this artifact where the build itself is failing, as we're working through with 72 comments here, a couple PRs with lots of comments also, and we think a strategy that will fix it.

Hold tight and this should be sorted soon

Salakar commented 9 months ago

Yes, was planning to reply after some sleep sorry, but Flutter should be working now on SDK 10.19 and 10.20, same integration as originally;

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

This was tested by myself and @russellwheatley today and confirmed working for us, please try it out.

React Native has not been tested yet but in theory should work.

Make sure to run pod cache clean --all and rm -rf ios/Pods ios/Podfile.lock if you have any issues.

josiahsrc commented 9 months ago

@Salakar Exciting news!! I tested it out, however, I am unable to pin version 10.19 or 10.20 because the latest version of flutter cloud_firestore doesn't support those versions. Here is the output I'm seeing:

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

    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.14.0, which depends on
      Firebase/Firestore (= 10.18.0) was resolved to 10.18.0, which depends on
        FirebaseFirestore (~> 10.18.0)

Installing cloud_firestore directly from main doesn't seem to fix the issue either

russellwheatley commented 9 months ago

@josiahsrc - hmmm, I thought we'd cut a release with firebase-ios-sdk 10.19.0 but it appears it hasn't gone out yet. We will be cutting a release today which contains 10.20.0. If you can't wait, you can actually change the version in your Podfile by adding the following variable that is picked up by firebase_core:


# Add the below line to your Podfile
$FirebaseSDKVersion = '10.19.0'

Just remember to remove it when FlutterFire release goes out today so it doesn't pin the firebase-ios-sdk version 👍

russellwheatley commented 9 months ago

I saw that Paul's PR was closed without any further info? Is there any update on this?

@matt-hall-zory We have already updated the codebase with Paul's changes and some other required changes.

russellwheatley commented 9 months ago

Hey FlutterFire folks, we have released the latest cloud_firestore package (depends on latest firebase_core with the latest firebase-ios-sdk version 10.20.0). If you upgrade your FlutterFire packages to the latest version and update this line in your Podfile:

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

It should work as intended. Please let me know how it goes and if you encounter any issues!

For any other platforms (i.e. React Native Firebase), could you please test and let me know how it goes? Thanks 🙏

josiahsrc commented 9 months ago

It works! Just tested again with 10.20 and everything worked flawlessly. Hello again, 19 second build times 🤩 Soooooo fast. Thanks @russellwheatley @Salakar @paulb777 and all others who helped in fixing this!

mikehardy commented 9 months ago

This is confirmed working for react-native-firebase as well now.

I believe this is close able, but however if reality contradicts that belief in form of someone with a reproduction where it still doesn't work, obviously we can reopen and keep working away on this one

(fantastic work bringing this one home - @russellwheatley @paulb777 @Salakar - seriously)

szotp-lc commented 9 months ago

Doesn't work for me, FIrebaseFirestoreBinary target is empty, no framework, no files.

But I figured a decent workaround: use a compiled FirebaseFirestoreInternal with its dependencies & regular FirebaseFirestore, this still cuts compilation time significantly.

Here is a relevant part of Podfile for Flutter (for my workaround)

target 'Runner' do
  use_frameworks! :linkage => :static # this line is important
  use_modular_headers!

  pod 'FirebaseFirestoreInternal', :podspec => 'https://gist.githubusercontent.com/szotp-lc/da7c0fe3ed2d0c622fe62348110cb7ef/raw/8e054439082657f9b08e0a0356aa3ef67a90f87b/FirebaseFirestoreInternal.podspec'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
mikehardy commented 9 months ago

oh no - thanks for the report @szotp-lc - sadly but dutifully reopening

mikehardy commented 9 months ago

@szotp-lc can you post the podfile contents that do not work? Might help to repro

szotp-lc commented 9 months ago

Project.zip

Added a project with build error and screenshot. Notice that abseil framework ins included, but FirebaseFirestore and FIrebaseFirestoreBinary are empty.

Screenshot 2024-01-31 at 17 06 33

josiahsrc commented 9 months ago

@szotp-lc Perhaps it's the static headers and modular headers. This is what I'm using, maybe it will work for you?

target 'Runner' do
  use_frameworks!
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.20.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
russellwheatley commented 9 months ago

@szotp-lc can you post the podfile contents that do not work? Might help to repro

On top of this, please show the build output from your terminal 👌

lukepighetti commented 9 months ago

working for me! airdrop from heaven!!

szotp-lc commented 9 months ago

New solution doesn't include FirebaseFirestore.xcframework as vendored_framework so how it could possibly work?

https://github.com/search?q=repo%3Ainvertase%2Ffirestore-ios-sdk-frameworks%20vendored&type=code

russellwheatley commented 9 months ago

@szotp-lc https://github.com/invertase/firestore-ios-sdk-frameworks/blob/main/FirebaseFirestoreInternalBinary.podspec#L19

matt-hall-zory commented 9 months ago

This didn't built at first. Same error as before. I had been using 10.18.0.

Error (Xcode): Undefined symbols:
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

But I did update all the relevant Firebase packages and upgraded to 10.20.0 and I was able to get it to build.

russellwheatley commented 8 months ago

Closing out as this issue is resolved. Thank you for the patience 🙏

felipecastrosales commented 8 months ago

I had forgotten to give my feedback on this.

I had been unable to run my application for months due to this issue, and the version bump actually helped me. Thank you so much guys.

jmw11x commented 7 months ago

I have had this issue show up today when adding firebase messaging to the flutter application I have tried all fixes and still am met with the same error. The only fix that worked was making a new flutter project and init firebase with flutter fire then bring in lib folder and import pub all new.

error produced

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy.blob(FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrate gy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodi ngStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.keyDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.KeyDecodingStrategy

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy.custom(FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStra tegy.Type) -> ((Swift.Decoder) throws -> Foundation.Date) -> FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dataDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.DataDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.dateDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.DateDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.passthroughTypeResolver.setter : FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy.throw(FirebaseSharedSwift.FirebaseDataDecoder.Non ConformingFloatDecodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.nonConformingFloatDecodingStrategy.setter : FirebaseSharedSwift.FirebaseDataDecoder.NonConformingFloatDecodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.decode<A where A: Swift.Decodable>(_: A.Type, from: Any) throws -> A

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataDecoder.userInfo.setter : [Swift.CodingUserInfoKey : Any]

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy.blob(FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrate gy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy.useDefaultKeys(FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodi ngStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.keyEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.KeyEncodingStrategy

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy.custom(FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStra tegy.Type) -> ((Foundation.Date, Swift.Encoder) throws -> ()) -> FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dataEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.DataEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.dateEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.DateEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.passthroughTypeResolver.setter : FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.Type

Error (Xcode): Undefined symbol: enum case for FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy.throw(FirebaseSharedSwift.FirebaseDataEncoder.Non ConformingFloatEncodingStrategy.Type) -> FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.nonConformingFloatEncodingStrategy.setter : FirebaseSharedSwift.FirebaseDataEncoder.NonConformingFloatEncodingStrategy

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.encode<A where A: Swift.Encodable>(A) throws -> Any

Error (Xcode): Undefined symbol: dispatch thunk of FirebaseSharedSwift.FirebaseDataEncoder.userInfo.setter : [Swift.CodingUserInfoKey : Any]

Error (Xcode): Undefined symbol: method descriptor for static FirebaseSharedSwift.StructureCodingPassthroughTypeResolver.isPassthroughType(A1) -> Swift.Bool

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator. Error launching application on iPhone 15 Pro Max.

dependencies: flutter: sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2 firebase_core: ^2.15.1 firebase_auth: ^4.8.0

cloud_firestore: ^4.14.0 cloud_functions: ^4.4.0 provider: ^6.0.5 flutter_spinkit: ^5.2.0 form_builder_validators: ^9.0.0-dev.1 intl: ^0.18.0 flutter_form_builder: ^9.1.0 syncfusion_flutter_datepicker: ^24.2.8 flutter_local_notifications: ^16.3.2 flutter_datetime_picker: ^1.5.0 speech_to_text: ^6.6.0 highlight_text: ^1.7.0 avatar_glow: ^3.0.1 timezone: ^0.9.2 firebase_messaging: ^14.7.10

podfile

Uncomment this line to define a global platform for your project

platform :ios, '12.0'

CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

source 'https://github.com/paulb777/TestFirebaseBinaryStaging.git' source 'https://cdn.cocoapods.org/'

project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, }

def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), FILE) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end

File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.18.0' use_frameworks! use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(FILE)) target 'RunnerTests' do inherit! :search_paths end end

post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end

AlehSabadashGmail commented 1 month ago

reproduced with 11.0.0 version, why has it been closed?