简体   繁体   中英

Could not build the application for the simulator after adding cloud_firestore to pubspec Flutter

I added dependencies to my pubspec.yaml file and pubget ran without errors, then I entered flutter run and i got this error, before adding any of the dependencies the application ran fine on the ios emulator:

////////////////////////////////////////////////////

Launching lib/main.dart on iPhone X in debug mode...
Running pod install...                                             54.9s
Running Xcode build...                                                  

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


Xcode's output:
↳
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
    asses/CloudFirestorePlugin.m:155:24: error: no visible @interface for 'FIRQuery'
    declares the selector 'queryWhereField:arrayContainsAny:'
            query = [query queryWhereField:fieldName arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
    asses/CloudFirestorePlugin.m:157:24: error: no visible @interface for 'FIRQuery'
    declares the selector 'queryWhereFieldPath:arrayContainsAny:'
            query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
    asses/CloudFirestorePlugin.m:163:24: error: no visible @interface for 'FIRQuery'
    declares the selector 'queryWhereField:in:'
            query = [query queryWhereField:fieldName in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
    asses/CloudFirestorePlugin.m:165:24: error: no visible @interface for 'FIRQuery'
    declares the selector 'queryWhereFieldPath:in:'
            query = [query queryWhereFieldPath:fieldPath in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Cl
    asses/CloudFirestorePlugin.m:764:16: warning: 'timestampsInSnapshotsEnabled' is
    deprecated [-Wdeprecated-declarations]
          settings.timestampsInSnapshotsEnabled =
          (bool)call.arguments[@"timestampsInSnapshotsEnabled"];
                   ^
    In module 'FirebaseFirestore' imported from
    /Users/kev/Documents/flutterprojects/shopapp/ios/Pods/Headers/Public/Firebase/Fireba
    se.h:45:
    /Users/kev/Documents/flutterprojects/shopapp/ios/Pods/FirebaseFirestore/Firestore/So
    urce/Public/FIRFirestoreSettings.h:69:20: note: 'timestampsInSnapshotsEnabled' has
    been explicitly marked deprecated here
        __attribute__((deprecated));
                       ^
    1 warning and 4 errors generated.
    note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone X.

/////////////////////////////////////////

this is what my pubspec file looks like:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cloud_firestore: ^0.12.11
  cupertino_icons: ^0.1.2
  firebase_core: ^0.4.2+1
  firebase_analytics: ^5.0.6
  firebase_auth: ^0.15.1

this is flutter doctor results:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.13.6 17G9016, locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 10.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Github issue link

In the Flutter terminal try this:

  • cd ios
  • pod update Firebase/Firestore

For me works perfectly after that.

1- Open xcode for the iOS project by clicking on Runner.xcworkspace file located in ios directory

2- Click Runner (on the left of the xcode)

3- Click on Build Settings tab (in the middle of xcode)

4- Change iOS Deployment Target to 12.1 for example

5- Save your action

6- Run flutter clean then run your app

From flutter terminal, try this:

  • flutter clean
  • cd ios
  • pod update Firebase/Firestore

Now flutter run will work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM