FLUTTER:词法或预处理器问题(Xcode):未找到“TensorFlowLiteC.h”文件

olqngx59  于 2023-05-19  发布在  Flutter
关注(0)|答案(1)|浏览(167)

我是iOS开发新手。我的flutter项目有tflite:依赖运行tflite模型,但当我试图构建iOS应用程序它给出了上述错误.
它在Android上运行良好。
下面是我的Podfile代码

platform :ios, '11.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! #add here
  use_frameworks! :linkage => :static
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

当我执行命令flutter build ios时,它给出如下错误:

Automatically signing iOS for device deployment using specified development team in Xcode project: 937S4T5D4R
Running pod install...                                              6.3s
Running Xcode build...                                                  
Xcode build done.                                           17.3s
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): 'TensorFlowLiteC.h' file not found
/Users/amventuresprivatelimited/.pub-cache/hosted/pub.dev/tflite-1.1.2/ios/Classes/TflitePlugin.mm:19:8

Encountered error while building for device.

如果有任何人熟悉这个问题,请提供帮助。先谢谢你了。

ryhaxcpt

ryhaxcpt1#

我在使用tflite_flutter时遇到了同样的问题。尝试按照此处列出的iOS步骤操作。基本上,您需要在插件发布缓存文件夹中添加Tensorflow的编译版本。如果你需要使用GPU Delegate,你可以遵循Tensorflow的官方文档。

相关问题