【问题标题】:Flutter - firebase_ml_vision - doesn't build on IOS - textRecognizer doesn't workFlutter - firebase_ml_vision - 不在 IOS 上构建 - textRecognizer 不起作用
【发布时间】:2021-02-28 22:31:54
【问题描述】:

Flutter - 试图让 textRecognizer 在 IOS 上工作

firebase_ml_vision - 不在 IOS 上构建

pubspec.yaml:

  firebase_core: ^0.7.0
  firebase_auth: ^0.20.1
  cloud_firestore: ^0.16.0+1
  firebase_storage: ^7.0.0
  firebase_ml_vision: ^0.10.0

Pod 文件:

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    # Can be removed when moving to cocoapods 1.10
    config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
  end
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
      # Inherit the deployment target defined in this Podfile instead, e.g. platform :ios, '11.0' at the top of this file
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

运行flutter build ios

 <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORPrioritizer.h' [-Werror,-Wincomplete-umbrella]
    #import "Headers/GoogleDataTransport-umbrella.h"
    ^
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORRegistrar.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORStorageEventSelector.h'
    [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORPlatform.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORStorageProtocol.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORUploader.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORAssert.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORLifecycle.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORReachability.h' [-Werror,-Wincomplete-umbrella]
    <module-includes>:1:1: error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORUploadPackage.h' [-Werror,-Wincomplete-umbrella]
    10 errors generated.
    In file included from /Users/user924432/work/zapit/zapit/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m:20:
    /Users/user924432/work/zapit/zapit/ios/Pods/FirebaseCoreDiagnostics/GoogleDataTransport/GDTCORLibrary/Internal/GoogleDataTransportInternal.h:18:9: fatal error:
    could not build module 'GoogleDataTransport'
    #import <GoogleDataTransport/GoogleDataTransport.h>
     ~~~~~~~^
    While building module 'GoogleUtilities' imported from
    /Users/user924432/work/zapit/zapit/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m:22:
    <module-includes>:1:1: error: umbrella header for module 'GoogleUtilities' does not include header 'GULLoggerCodes.h' [-Werror,-Wincomplete-umbrella]
    #import "Headers/GoogleUtilities-umbrella.h"
    ^
    1 error generated.
    12 errors generated.
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

试过pod update

FF035:ios user924432$ pod update
Update all pods
Updating local specs repositories

CocoaPods 1.10.1 is available.
To update use: `sudo gem install cocoapods`

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.10.1

Analyzing dependencies
cloud_firestore: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
firebase_ml_vision: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '7.3.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.4.0)
Installing BoringSSL-GRPC (0.0.7)
Installing DKImagePickerController (4.3.2)
Installing DKPhotoGallery (0.0.17)
Installing FMDB (2.7.5)
Installing Firebase (7.3.0)
Installing FirebaseAuth (7.3.0)
Installing FirebaseCore (7.3.0)
Installing FirebaseCoreDiagnostics (7.3.0)
Installing FirebaseFirestore (7.3.0)
Installing FirebaseInstallations (7.7.0)
Installing FirebaseInstanceID (7.7.0)
Installing FirebaseMLCommon (7.6.0-beta)
Installing FirebaseMLVision (7.3.0-beta)
Installing FirebaseMessaging (7.3.0)
Installing FirebaseStorage (7.3.0)
Installing Flutter (1.0.0)
Installing GTMAppAuth (1.1.0)
Installing GTMSessionFetcher (1.5.0)
Installing GoogleAPIClientForREST (1.5.1)
Installing GoogleDataTransport (8.1.0)
Installing GoogleSignIn (5.0.2)
Installing GoogleToolboxForMac (2.3.1)
Installing GoogleUtilities (7.2.2)
Installing Mantle (2.1.6)
Installing PromisesObjC (1.2.12)
Installing Protobuf (3.14.0)
Installing SDWebImage (5.10.4)
Installing SDWebImageWebPCoder (0.8.3)
Installing SwiftyGif (5.4.0)
Installing abseil (0.20200225.0)
Installing camera (0.0.1)
Installing cloud_firestore (0.16.0-1)
Installing device_info (0.0.1)
Installing esys_flutter_share (0.0.1)
Installing file_picker (0.0.1)
Installing firebase_auth (0.20.1)
Installing firebase_core (0.7.0)
Installing firebase_messaging (8.0.0-dev.15)
Installing firebase_ml_vision (0.1.1)
Installing firebase_storage (7.0.0)
Installing flutter_exif_rotation (0.3.0)
Installing flutter_html_to_pdf (0.0.1)
Installing flutter_image_compress (0.0.1)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing geolocator (6.2.0)
Installing google_sign_in (0.0.1)
Installing image_picker (0.0.1)
Installing leveldb-library (1.22)
Installing libwebp (1.2.0)
Installing nanopb (2.30906.0)
Installing native_device_orientation (0.0.1)
Installing path_provider (0.0.1)
Installing pdf_render (0.0.1)
Installing permission_handler (5.1.0+2)
Installing receive_sharing_intent (0.0.1)
Installing share (0.0.1)
Installing shared_preferences (0.0.1)
Installing sqflite (0.0.2)
Installing url_launcher (0.0.1)
Installing z_ocr (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 27 dependencies from the Podfile and 62 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).

[!] The `Runner [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `Runner [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `Runner [Profile]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] FirebaseMLCommon has been deprecated

[!] FirebaseMLVision has been deprecated
FF035:ios user924432$ 

【问题讨论】:

    标签: flutter firebase-machine-learning


    【解决方案1】:

    已解决:

    pod deintegrate
    pod update
    flutter clean
    flutter build ios
    

    注意:虽然它编译它仍然不起作用 - 请参阅https://github.com/FirebaseExtended/flutterfire/issues/5174

    如果您使用的是设备端 API 之一,请包含相应的 Podfile 中的 ML Kit 库模型。然后在 a 中运行 pod update 终端与 Podfile 位于同一目录中。

    仅供参考,目前会遇到 #4625 谢谢

    见https://github.com/FirebaseExtended/flutterfire/issues/4625

    我能够让 textRecognizer 在 ios 上使用以下内容:

    pubspec.yaml

      firebase_core: "^0.5.0"
      firebase_auth: ^0.18.1+1
      cloud_firestore: ^0.14.1+1
      firebase_storage: ^5.0.0-dev.2
      firebase_ml_vision: ^0.9.10
    

    播客文件

    pod 'Firebase/MLVision'
    # If using an on-device API:
    pod 'Firebase/MLVisionTextModel'
    

    【讨论】:

    • 虽然命令可能会为问题提供解决方案,但最好添加有关它为什么/如何工作的上下文。这可以帮助未来的用户学习并最终将这些知识应用到他们自己的代码中。解释代码时,您也可能会得到用户的积极反馈/赞成。
    猜你喜欢
    • 2019-02-27
    • 1970-01-01
    • 2021-01-25
    • 2021-01-13
    • 1970-01-01
    • 2020-09-10
    • 2020-07-16
    • 1970-01-01
    • 2020-07-24
    相关资源
    最近更新 更多