xcode 在Flutter 2.0.4上构建iOS应用程序错误:'Flutter/Flutter.h'文件未找到

jhkqcmku  于 2023-08-07  发布在  Flutter
关注(0)|答案(1)|浏览(181)

我一直在尝试从Android Studio在iOS上运行应用程序。我一直在犯错误

/Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    /Users/apple/StudioProjects/example-app/ios/Runner/GeneratedPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header '/Users/apple/Library/Developer/Xcode/DerivedData/Runner-ggksyvhflvuluxawpqfuznxyoqim/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_LWMBPN794CZS-clang_BZEEHKV9P35.pch' for bridging header '/Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h'
    /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    2 errors generated.
    <unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

字符串
我已经试过Flutter iOS build failed an error of pod files: Podfile is out of date
这是我的Flutter医生

[✓] Flutter (Channel stable, 2.0.4, on macOS 11.1 20C69 darwin-x64, locale en-GB)
    • Flutter version 2.0.4 at /Users/apple/development/mobile/flutter
    • Framework revision b1395592de (10 days ago), 2021-04-01 14:25:01 -0700
    • Engine revision 2dce47073a
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/apple/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Connected device (4 available)
    • iPhone (mobile)            • 34570a362a2df73d484d834ef7354c1be8983665 • ios            • iOS 14.4
    • iPhone 12 Pro Max (mobile) • 0EDA0F75-828C-4663-BF48-CC40B7F6BD66     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    • darwin-x64     • macOS 11.1 20C69 darwin-x64
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome 89.0.4389.114

• No issues found!
Process finished with exit code 0


有什么建议吗?

epggiuax

epggiuax1#

我也遇到了同样的问题,我通过这样做来解决它:其原因是插件在 Flutter * 依赖 *。如何解决这个问题:
首先关闭xcode/android studio(flutter)/vs code(flutter)并重新启动PC。
然后打开vs code/android studio,转到ios目录并在终端中打开它,然后写:
1.第一个月

  1. pod install
  2. flutter build ios
  3. flutter run

相关问题