Flutter Xcode“未定义的名称”主要“,”

hof1towb  于 2022-12-14  发布在  Flutter
关注(0)|答案(2)|浏览(179)

当我尝试在xcode中或通过“flutter build ios”命令构建flutter项目时,我得到以下错误:

这是Flutter医生输出:

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.2 21D49 darwin-arm, locale it-IT)
    • Flutter version 2.8.1 at /Users/Fenix/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (7 settimane fa), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/Fenix/Library/Android/sdk
    • Platform android-31, 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 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] 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 M1.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-7772763)

[✓] 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)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)

我试过在构建阶段检查“仅用于安装构建”,但我得到不同的文件未找到错误。我也试过flutter clean,Clean Build Folder,pod reinstall等。
谢谢你,谢谢

von4xj4u

von4xj4u1#

我用这个命令解决了建造:

flutter build ios -t lib/splashscreen.dart --release

其中splashscreen.dart是应用程序的入口点,void main() => runApp(...)位于其中。
感谢所有评论。

b5buobof

b5buobof2#

您忘记在代码中添加void main =〉runapp(/包含materialapp()/的类)

相关问题