Fix: no visible @interface for ‘FIRQuery’ declares the selector

Fix: no visible @interface for 'FIRQuery' declares the selector

Written by

in

Quick answer: The error is an Objective-C compile failure inside the FirebaseFirestore pod, not in your Dart code: the cloud_firestore iOS plugin calls query selectors that only exist in a newer Firestore SDK than the one pinned in ios/Podfile.lock. Delete Podfile.lock, run pod update FirebaseFirestore, then flutter clean and flutter run.

Why this happens

The build fails inside a CocoaPods dependency, not in your own code. cloud_firestore‘s iOS plugin file CloudFirestorePlugin.m is compiled against the FirebaseFirestore pod, and it calls query operators such as queryWhereField:arrayContainsAny: and queryWhereField:in:. Those selectors only exist in newer releases of the native Firestore SDK. If the pod that actually gets compiled is older, the compiler cannot find the method on FIRQuery and emits:

error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:arrayContainsAny:'

Four of those errors are enough to fail the target, which Flutter then reports as Could not build the application for the simulator. Error launching application on iPhone 11 Pro Max.

The usual reason for the mismatch is that the Dart side and the iOS side were updated at different times. flutter pub upgrade bumps the plugin in .pub-cache, but pod install honours the versions already written into ios/Podfile.lock, so the native Firebase pods stay where they were. The Mapping architecture armv7 to i386 lines in the same log are unrelated warnings from older plugins — the build is failing on the four errors, not on those.

How to fix it

1. Re-resolve the Firestore pod

This is the fix that matches the root cause. pod install keeps the locked version; pod update does not.

cd ios
rm Podfile.lock
pod update FirebaseFirestore
cd ..
flutter clean
flutter run

If other Firebase pods (analytics, messaging, auth) are also behind and complain about version conflicts, drop the pod name and re-resolve everything:

cd ios
rm Podfile.lock
pod update
cd ..
flutter clean
flutter run

If CocoaPods stops with a message that a pod requires a higher deployment target, raise the platform :ios, '...' line at the top of ios/Podfile to the version it asks for, then run pod install again.

2. Upgrade the plugin itself, then rebuild clean

If the pod update alone does not help, the plugin in your pubspec.yaml may be too old for the Firebase SDK you are now pulling in. Upgrade it and start from a clean iOS state:

flutter pub upgrade --major-versions
flutter clean
rm -rf ios/Pods ios/Podfile.lock
flutter pub get
cd ios && pod install && cd ..
flutter run

--major-versions rewrites the constraints in pubspec.yaml to the latest resolvable versions, which is what you want when a plugin and its native SDK have drifted apart. Review the diff it produces before committing.

3. The “delete the Podfile” answer, and why it is a blunt tool

A widely shared solution is to remove the Podfile entirely, then let Flutter regenerate it:

rm ios/Podfile
flutter pub upgrade
flutter pub get
cd ios && pod update && cd ..
flutter clean && flutter run

This works because Flutter recreates a default Podfile when it is missing, and the regenerated file has no stale pod versions attached to it. The catch is that you lose anything custom in that file — the platform :ios line, post_install hooks that set build settings, and any extra pods you added by hand. Deleting Podfile.lock and the Pods folder achieves the same re-resolution without throwing away your configuration, so try step 1 first.

4. Get the full error text before guessing

IDEs often truncate the Xcode output, which is how people end up applying fixes for the wrong error. Run from a terminal instead:

flutter run

For a build-only pass with the complete log:

flutter build ios --simulator --debug

Read the first error: line, not the last. If it still points at CloudFirestorePlugin.m, the pod is still the old one — check ios/Podfile.lock for the resolved FirebaseFirestore version and confirm it changed after your pod update.

5. Clear DerivedData if the same errors survive a clean

A stale module cache can keep reporting selectors that the new pod does define.

rm -rf ~/Library/Developer/Xcode/DerivedData
flutter clean
flutter run

How to prevent it

  • Run pod update (not just pod install) after every flutter pub upgrade that touches a plugin with native code.
  • Keep all Firebase pods on the same major version; mixing an old FirebaseFirestore with a new firebase_core produces exactly this class of error.
  • Commit Podfile.lock for reproducible builds, but treat it as something to refresh deliberately, not as a file to hand-edit.
  • When a build fails, run flutter run from a terminal so you see the complete Xcode output instead of a trimmed version.
  • Keep the platform :ios line in ios/Podfile in sync with the deployment target set in the Xcode project.

FAQ

Does this error come from my Dart code?

No. The failing file is CloudFirestorePlugin.m inside the pub cache, compiled by Xcode as part of the cloud_firestore pod. Your Dart code never reaches the compiler in this case.

Why doesn’t pod install fix it?

pod install respects the versions recorded in Podfile.lock and only installs what is missing. To move a pod to a newer version you need pod update, which re-resolves the dependency graph.

Do the “Mapping architecture armv7 to i386” warnings matter?

No. Those come from older plugins declaring simulator architectures the build system has to remap, and they are warnings. The build fails on the no visible @interface errors, so fix those first and ignore the architecture lines.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.