将cloud_firestore添加到pubspec Flutter后,无法为模拟器构建应用程序

时间:2019-12-05 05:13:21

标签: ios firebase flutter visual-studio-code google-cloud-firestore

我在pubspec.yaml文件中添加了依赖项,并且pubget运行时没有错误,然后我进入了flutter run并且出现了此错误,然后添加了任何依赖项,应用程序在ios模拟器上运行良好:

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

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.

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

这是我的pubspec文件的样子:

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

这是扑扑医生的结果:

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

3 个答案:

答案 0 :(得分:3)

在Flutter终端中尝试以下操作:

  • cd ios
  • pod更新Firebase / Firestore

在那之后,对我来说工作完美。

答案 1 :(得分:0)

1-通过单击位于ios目录中的 Runner.xcworkspace 文件为iOS项目打开xcode

2-点击 Runner (在xcode的左侧)

3-单击 Build Settings 标签(在xcode的中间)

4-例如,将 iOS部署目标更改为12.1

5-保存您的操作

6-运行flutter clean,然后运行您的应用

答案 2 :(得分:0)

在flutter终端上,尝试以下操作:

  • 干净整洁
  • cd ios
  • pod更新Firebase / Firestore

现在扑扑运行将按预期进行。