首页 > 解决方案 > Flutter 在为 iOS 构建时卡在“正在运行 Xcode 构建...”

问题描述

我有一个现有的 Flutter 项目,已经运行了两年。但是现在突然之间,当我尝试在 iOS 上构建或运行它时,它总是卡在Running Xcode build... .

flutter build ios --debug
Running "flutter pub get" in MyApp...                           0.6s
Building org.example.myapp for device (ios)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 36U5A9XK2Z
Running pod install...                                              1.6s
Running Xcode build...                                                  
(This is taking an unexpectedly long time.)       ⣻

在此之前只需要 1-2 分钟,现在我尝试等待长达 2 小时,所以显然有些地方很不对劲。其他现有应用程序构建得很好。

我试过“通常的嫌疑人”:

似乎没有任何帮助。如果我尝试从 XCode 或 IntelliJ 中运行应用程序,也会发生同样的事情。版本信息如下。

Flutter 1.22.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7891006299 (7 weeks ago) • 2020-12-10 11:54:40 -0800
Engine • revision ae90085a84
Tools • Dart 2.10.4```

XCode 11.1
OSx 10.15.1

标签: iosxcodeflutterxcodebuildflutter-build

解决方案


您可以尝试删除ios项目中的文件夹并通过运行再次生成 iOS 版本flutter create --platforms=ios [PROJECT_PATH]。这应该会从您的 Flutter 代码生成一个 iOS 项目。之后,您可以尝试flutter build ios再次运行。


推荐阅读