【问题标题】:Add firebase_ml_vision to flutter raise an error 'Unknown type name 'FIRVisionCloudLabelDetector'添加 firebase_ml_vision 以引发错误“未知类型名称”FIRVisionCloudLabelDetector
【发布时间】:2019-01-29 12:32:45
【问题描述】:

将 firebase_ml_vision: 0.3.0 添加到现有项目时,构建 xcode 时总是抱怨:未知类型名称 'FIRVisionCloudLabelDetector'。

如果排除 firebase_ml_vision,则可以编译项目。

这是我的颤振医生结果:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.1.9, on Mac OS X 10.14.1 18B75, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.2)
[✓] Connected device (1 available)

我尝试重新安装 cocoapods 并使用 'flutter upgrade' 升级 Flutter 和使用 'cd ios && pod update' 升级 pod,但仍然无法正常工作。

【问题讨论】:

    标签: firebase dart flutter firebase-mlkit


    【解决方案1】:

    我遇到了同样的问题,解决方法是降级MLVisionLabelModel

    为此,在 xcode 中打开您的项目并打开 Podfile 然后添加

    pod 'Firebase/MLVisionLabelModel', '5.15.0'
    

    然后重新运行。它应该可以正常工作。

    【讨论】:

    • 我刚刚遇到了这个问题,今天通过将这三个版本都升级到 5.16.0,我能够在 iOS 上运行构建。
    【解决方案2】:

    我的 pod 文件更改了以下区域,我遇到了同样的问题:

    # Uncomment this line to define a global platform for your project
    platform :ios, '9.0'
    
    ...
    
    target 'Runner' do
    
      use_frameworks!
    
    ...
    
      pod 'GoogleAppMeasurement'
      pod 'Firebase/Core'
      pod 'Firebase/Messaging'
      pod 'Firebase/MLVisionBarcodeModel', '5.15.0'
      pod 'Firebase/MLVisionLabelModel', '5.15.0'
      pod 'Firebase/MLVisionTextModel', '5.15.0'
    

    我将所有 5.15.0 更改为 5.16.0,并执行命令:'pod update',这个问题就消失了。在使用 pubspec.yaml 构建 ios 和 androidX 之前,我也在玩游戏。对于 androidX 构建,我有以下内容:

      # Build for AndroidX
      #firebase_ml_vision: ^0.9.2
      firebase_ml_vision: ^0.8.0
    
      # Build for iOS
      #firebase_ml_vision: ^0.2.1
    
      flutter_camera_ml_vision: ^2.2.1
    

    它奏效了。但随后给出了 iOS 的升级问题。所以现在一旦我去 5.16.0 我只能有以下行:

      flutter_camera_ml_vision: ^2.2.1
    

    【讨论】:

      猜你喜欢
      • 2012-02-20
      • 2016-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-29
      相关资源
      最近更新 更多