Flutterfire: [cloud_firestore] ** BUILD FAILED ** no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:arrayContainsAny

Created on 21 Dec 2019  Â·  4Comments  Â·  Source: FirebaseExtended/flutterfire

Describe the bug
after installing version 0.13.0+1 of cloud_firestore => boilerplate Flutter test app (that did run) now crashes.

To Reproduce
Steps to reproduce the behavior using Visual Studio Code:

  1. create a new Flutter app
  2. create a new Firebase iOS project via web console
  3. download the GoogleService-Info.plist and drop it into Runner/Runner in Xcode
  4. add firebase_core: ^0.4.3+1 to pubspec.yaml
  5. add cloud_firestore: ^0.13.0+1 to pubspec.yaml
  6. wait for flutter packages get to finish
  7. try to launch the app on iOS simulator. never launches and produces this error in the console
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    /Users/xxxxx/flutter-dev-lib/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ios/Classes/FLTCloudFirestorePlugin.m:155:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:arrayContainsAny:'
            query = [query queryWhereField:fieldName arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/xxxxx/flutter-dev-lib/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ios/Classes/FLTCloudFirestorePlugin.m:157:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereFieldPath:arrayContainsAny:'
            query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/xxxxx/flutter-dev-lib/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ios/Classes/FLTCloudFirestorePlugin.m:163:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:in:'
            query = [query queryWhereField:fieldName in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/xxxxx/flutter-dev-lib/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ios/Classes/FLTCloudFirestorePlugin.m:165:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereFieldPath:in:'
            query = [query queryWhereFieldPath:fieldPath in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4 errors generated.
    note: Using new build system
    note: Planning build
    note: Constructing build description
Could not build the application for the simulator.

Expected behavior
it works

Additional context
here's your problem code (Objective-C) in FLTCloudFirestorePlugin.m

  } else if ([op isEqualToString:@"array-contains-any"]) {
      if (fieldName != nil) {
        query = [query queryWhereField:fieldName arrayContainsAny:value];  <=======
      } else if (fieldPath != nil) {
        query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];  <======
      } else {
        // Invalid type.
      }
    } else if ([op isEqualToString:@"in"]) {
      if (fieldName != nil) {
        query = [query queryWhereField:fieldName in:value];  <=========
      } else if (fieldPath != nil) {
        query = [query queryWhereFieldPath:fieldPath in:value];  <=========
      } else {
        // Invalid type.
      }
    } else {
      // Unsupported operator
    }

WORKAROUND - this combination of versions currently works:

  firebase_core: ^0.4.3+1

  # => firebase_auth 0.15.3 broke the build. google needs to fix it.
  firebase_auth: 0.15.1

  # => cloud_firestore 0.13.0+1 broke the build. google needs to fix it.
  cloud_firestore: 0.12.10

flutter doctor --verbose

flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-AU)
    • Flutter version 1.12.13+hotfix.5 at /Users/xxxxx/flutter-dev-lib/flutter
    • Framework revision 27321ebbad (10 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/xxxxx/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • 12A30E0B-6302-435D-9766-A2DA1601AF9B • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!
bug

Most helpful comment

In the flutter project ios path run

pod update Firebase/Firestore

All 4 comments

In the flutter project ios path run

pod update Firebase/Firestore

Hi @ajonno - this is down to your local Pods being out of date, please try running pod install --repo-update.

Closing for now.

I am having this issue updating to a more recent version of cloud_firestore. pod install --repo-update in the ios folder doesn't resolve it.

See more details here: https://github.com/shrop/contenta_flutter/issues/78#issuecomment-648791872

I was able to get this working by taking these steps, but not sure if all were actually needed.

  • Update cloud_firestore to ^0.13.7 in pubspec.yaml
  • rm ios/Podfile.lock
  • pod install --repo-update
  • flutter clean

From there flutter run and debugging in VScode worked for me.

Thanks to these comments for the help on things to try:

Was this page helpful?
0 / 5 - 0 ratings