我如何解决“词法或预处理器问题 (Xcode):Flutter/Flutter.h”找不到文件”?

发布于 2025-01-18 23:01:58 字数 4376 浏览 4 评论 0原文

     In file included from /Users/shaifdihan/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.m:5:
    /Users/shaifdihan/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
/Users/shaifdihan/StudioProjects/my_match_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'libPhoneNumber-iOS' from project 'Pods')
    .
    .
    .

是否可以在Internet上找到眼神的解决方案来解决该问题

  • POD DENETRATE,安装,更新,repo Update
  • DELETE iOS文件夹,Flutter Create。,复制Runner文件夹
  • 清洁,
  • 使用2.5.3构建的flutter Pub Pub修复项目,检查,检查,检查同样,使用2.10.3

,如果我删除了WebView_flutter插件,共享Preferences开始显示相同的flutter.h找不到...然后删除了共享Preferences软件包,现在许可处理程序处理程序包显示了相同的错误!

我的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!
      use_modular_headers!
    
      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
    post_install do |installer|
      installer.pods_project.targets.each do |target|
#        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |config|
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64 i386"
        end
      end
    end

flutter doctor -v

    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.6.5 20G527 darwin-x64, locale en-GB)
    • Flutter version 2.5.3 at /Users/shaifdihan/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (6 months ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/shaifdihan/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      
              
     In file included from /Users/shaifdihan/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.m:5:
    /Users/shaifdihan/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
/Users/shaifdihan/StudioProjects/my_match_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'libPhoneNumber-iOS' from project 'Pods')
    .
    .
    .

did eyery possible solution that i could find on the internet to solve the issue

  • pod deintegrate, install, update, repo update
  • delete iOS folder, flutter create ., copy Runner folder
  • flutter clean, flutter pub cache repair
  • project built with 2.5.3, checked with 2.10.3 also

if i remove the webview_flutter plugin, sharedpreferences starts to show the same Flutter.h not found...then removed the sharedpreferences package, now Permission Handler package shows the same error!!

My 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!
      use_modular_headers!
    
      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
    post_install do |installer|
      installer.pods_project.targets.each do |target|
#        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |config|
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64 i386"
        end
      end
    end

flutter doctor -v

    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.6.5 20G527 darwin-x64, locale en-GB)
    • Flutter version 2.5.3 at /Users/shaifdihan/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (6 months ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/shaifdihan/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ???? https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花期渐远 2025-01-25 23:01:58

我所做的是...

  • 将 Xcode 更新为最新,
  • 将 Xcode/Runner/General/Deployment Info 中的最低 iOS 版本更改为 12,
  • 然后,pod deintegrate、安装、更新、repo update
  • flutter clean
  • flutter pub

解决了这个问题

what i did was...

  • Updated Xcode to latest
  • change the minimum iOS version to 12 from Xcode/Runner/General/Deployment Info
  • then, pod deintegrate, install, update, repo update
  • flutter clean
  • flutter pub get

this solved the issue

如何视而不见 2025-01-25 23:01:58

我更新了cocoapods,使用了brew,重新安装了pod等,但都不起作用。

我所做的是删除 ios 文件,然后运行:

flutter create --platforms=ios .

它解决了我的问题(我遇到了这个问题:speech_to_text-Swift.h flutter)

I updated cocoapods, used brew, re-installed pods, etc but all did not work.

What I did instead, was delete the ios file, and run:

flutter create --platforms=ios .

It solved my problem (I had this problem: speech_to_text-Swift.h flutter)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文