-
更新系统配置好
Flutter环境报错,安卓无问题,iOS真机报错:The Dart VM Service was not discovered after 60 seconds. This is taking much longer than expected... Open the Xcode window the project is opened in to ensure the app is running. If the app is not running, try selecting "Product > Run" to fix the problem.默认
flutter run是--debug环境,改用flutter run --release就能正常跑起来项目,但是这样就丢失了热更新功能。 -
解决方案
-
Xcode中明确报出少了两个Key,是Flutter debug模式在iOS 14+上的必需配置-
NSBonjourServices— 声明 app 使用_dartVmService._tcpBonjour 服务(Flutter debug 用来发现 Dart VM) -
NSLocalNetworkUsageDescription— 本地网络访问权限描述(iOS 要求必须有)
<key>NSBonjourServices</key> <array> <string>_dartVmService._tcp</string> </array> <key>NSLocalNetworkUsageDescription</key> <string>Looking for local tcp Bonjour service for Flutter debugging.</string>配置后,尝试重新运行,不行就需要升级
Flutter版本,我这边是是3.27.4升级到3.38.10就没问题了。升级不能一次升级多个版本,要一个版本一个版本的来,免得问题扩大。
-
-
-
完整错误
Running Xcode build...
└─Compiling, linking and signing... 31.5s
Xcode build done. 69.0s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed,
you can change this through your Settings > Privacy & Security > Automation.
version=3.6.2 (stable) (Wed Jan 29 01:20:39 2025 -0800) on "ios_arm64"
pid=32757, thread=259, isolate_group=vm-isolate(0x104034000), isolate=vm-isolate(0x1043ed800)
os=ios, arch=arm64, comp=no, sim=no
isolate_instructions=105ddb5a0, vm_instructions=105ddb5a0
fp=16f2e5470, sp=16f2e5450, pc=10682d87c
pc 0x000000010682d87c fp 0x000000016f2e5470 Dart_DumpNativeStackTrace+0x18
pc 0x00000001063deed0 fp 0x000000016f2e5490 dart::Assert::Fail(char const*, ...) const+0x30
pc 0x00000001064da118 fp 0x000000016f2e5940 dart::Code::FinalizeCode(dart::FlowGraphCompiler*, dart::compiler::Assembler*, dart::Code::PoolAttachment, bool, dart::CodeStatistics*)+0x82c
pc 0x00000001065991e0 fp 0x000000016f2e5f50 dart::StubCode::Init()+0x31c
pc 0x0000000106429c48 fp 0x000000016f2e6a10 dart::Dart::DartInit(Dart_InitializeParams const*)+0x2a9c
pc 0x0000000106814328 fp 0x000000016f2e6a30 Dart_Initialize+0x3c
pc 0x0000000105ebeaf4 fp 0x000000016f2e7000 flutter::DartVM::Create(flutter::Settings const&, fml::RefPtr<flutter::DartSnapshot const>, fml::RefPtr<flutter::DartSnapshot const>, std::_fl::shared_ptr<flutter::IsolateNameServer>)+0x1d60
pc 0x00000001063957f4 fp 0x000000016f2e7760 flutter::Shell::Create(flutter::PlatformData const&, flutter::TaskRunners const&, flutter::Settings, std::_fl::function<std::_fl::unique_ptr<flutter::PlatformView, std::_fl::default_delete<flutter::PlatformView>> (flutter::Shell&)> const&, std::_fl::function<std::_fl::unique_ptr<flutter::Rasterizer, std::_fl::default_delete<flutter::Rasterizer>> (flutter::Shell&)> const&, bool)+0x310
pc 0x0000000105ddf060 fp 0x000000016f2e84d0 -[FlutterEngine createShell:libraryURI:initialRoute:]+0x934
pc 0x0000000105de6c4c fp 0x000000016f2e8540 -[FlutterViewController sharedSetupWithProject:initialRoute:]+0x1cc
pc 0x0000000105de6a58 fp 0x000000016f2e8570 -[FlutterViewController awakeFromNib]+0x58
pc 0x00000001a36a5374 fp 0x000000016f2e8a40 <redacted>+0x6dc
pc 0x00000001a3c7b61c fp 0x000000016f2e8ab0 <redacted>+0xec
pc 0x00000001a3c7b4f4 fp 0x000000016f2e8ae0 <redacted>+0x50
pc 0x00000001a3ad93e4 fp 0x000000016f2e8b40 <redacted>+0x8c
pc 0x00000001a2848a68 fp 0x000000016f2e8b80 <redacted>+0xa8
pc 0x00000001a3ad8908 fp 0x000000016f2e8d70 <redacted>+0x280
pc 0x00000001a30e1ea4 fp 0x000000016f2e8da0 <redacted>+0x74
pc 0x00000001a278de94 fp 0x000000016f2e8df0 _UIScenePerformActionsWithLifecycleActionMask+0x70
pc 0x00000001a30e2720 fp 0x000000016f2e8eb0 <redacted>+0xfc
pc 0x00000001a30e222c fp 0x000000016f2e8f20 <redacted>+0xd4
pc 0x00000001a30e2538 fp 0x000000016f2e9030 <redacted>+0x260
pc 0x00000001a30e1fc4 fp 0x000000016f2e90a0 <redacted>+0xf4
pc 0x00000001a30ed444 fp 0x000000016f2e90e0 <redacted>+0x94
pc 0x00000001a355fcec fp 0x000000016f2e91e0 <redacted>+0x2e0
pc 0x00000001a278ecac fp 0x000000016f2e9250 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion+0xe0
pc 0x00000001a30ed140 fp 0x000000016f2e9350 <redacted>+0x13c
pc 0x00000001a2f2c3b4 fp 0x000000016f2e94a0 <redacted>+0x268
pc 0x00000001a2f2b448 fp 0x000000016f2e9610 <redacted>+0xd0
pc 0x00000001a2f2c020 fp 0x000000016f2e96d0 <redacted>+0xf4
pc 0x00000001a3ad7968 fp 0x000000016f2e9790 <redacted>+0x1dc
pc 0x00000001a3588adc fp 0x000000016f2e9820 <redacted>+0x120
pc 0x00000001bce50388 fp 0x000000016f2e99d0 <redacted>+0x16c
pc 0x00000001bce50840 fp 0x000000016f2e9a10 <redacted>+0x80
pc 0x00000001bce501a0 fp 0x000000016f2e9ae0 <redacted>+0x1b4
pc 0x00000001bcebeb34 fp 0x000000016f2e9ba0 <redacted>+0x120
pc 0x00000001bce5df00 fp 0x000000016f2e9be0 <redacted>+0xa8
pc 0x00000001bce7ad98 fp 0x000000016f2e9d30 <redacted>+0x1e0
pc 0x00000001bce7c6fc fp 0x000000016f2e9dc0 <redacted>+0x10c
pc 0x00000001bce5df00 fp 0x000000016f2e9e00 <redacted>+0xa8
pc 0x0000000102e522e0 fp 0x000000016f2e9e10 _dispatch_client_callout+0x10
pc 0x0000000102e3c998 fp 0x000000016f2e9e60 _dispatch_block_invoke_direct+0x128
pc 0x00000001b45441d4 fp 0x000000016f2e9e90 <redacted>+0x34
pc 0x00000001b4544054 fp 0x000000016f2e9f10 <redacted>+0xe0
pc 0x000000019cdc5f10 fp 0x000000016f2e9f20 <redacted>+0x1c
pc 0x000000019cdc5e84 fp 0x000000016f2e9f50 <redacted>+0xac
pc 0x000000019cda3acc fp 0x000000016f2e9fb0 <redacted>+0xe8
pc 0x000000019cd7a6d8 fp 0x000000016f2ead10 <redacted>+0x334
pc 0x000000019cd79a6c fp 0x000000016f2eada0 <redacted>+0x214
pc 0x000000023e9a0498 fp 0x000000016f2eadf0 GSEventRunModal+0x78
pc 0x00000001a2752df8 fp 0x000000016f2eae70 <redacted>+0x318
pc 0x00000001a26fbe54 fp 0x000000016f2eaf00 UIApplicationMain+0x150
pc 0x00000001a2827820 fp 0x000000016f2eaf40 <redacted>+0x24c
pc 0x0000000101daa114 fp 0x000000016f2eaf90 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ+0x80
pc 0x0000000101daa084 fp 0x000000016f2eafc0 $s6Runner11AppDelegateC5$mainyyFZ+0x2c
pc 0x0000000101daa190 fp 0x000000016f2eafe0 __debug_main_executable_dylib_entry_point+0x1c
pc 0x0000000199d66e28 fp 0x000000016f2eb650 <redacted>+0x1bcc
-- End of DumpStackTrace
=== Crash occurred when compiling unknown function in unoptimized JIT mode in unknown pass
=== Flow Graph not available
The Dart VM Service was not discovered after 60 seconds. This is taking much longer than expected...
Open the Xcode window the project is opened in to ensure the app is running. If the app is not running, try
selecting "Product > Run" to fix the problem.
Installing and launching... ⢿^C
the Dart compiler exited unexpectedly.
Installing and launching...