You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS模拟器运行Flutter应用持续出现Lost connection to device错误求助

Flutter iOS模拟器"Lost connection to device"问题排查

问题现象

在iOS模拟器中运行Flutter应用时反复出现**"Lost connection to device"**错误,Android模拟器运行正常。

错误详情

Lost connection to device.
Error: Unable to terminate com.myPackageName.Dev on 6EAC7BBF-3767-44C4-886A-35D72D963210:
ProcessException: Process exited abnormally with exit code 3:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Simulator device failed to terminate com.myPackageName.Dev.
found nothing to terminate
Underlying error (domain=NSPOSIXErrorDomain, code=3):
    The request to terminate "com.myPackageName.Dev" failed. found nothing to terminate
    found nothing to terminate
  Command: /usr/bin/arch -arm64e xcrun simctl terminate 6EAC7BBF-3767-44C4-886A-35D72D963210 com.myPackageName.Dev
the Dart compiler exited unexpectedly.

已尝试的解决方案

  • 执行命令:flutter clean、flutter doctor、flutter run
  • 重启电脑
  • 删除驱动数据

开发环境

  • Android Studio Iguana | 2023.2.1 Patch 2
  • Dart 3.3.3
  • Flutter doctor检测结果:
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.88.1)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for Johnny’s iPhone 12 mini. Ensure the device is unlocked and attached with a cable or
      associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for Johnny ipad. Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iPhone  14 pro. Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

针对性解决建议

  1. 重置iOS模拟器
    • 打开iOS模拟器,点击顶部菜单Simulator > Erase All Content and Settings...,确认重置后重新运行应用。
  2. 清理iOS构建缓存并重新安装依赖
    • 执行以下命令:
      flutter clean
      rm -rf ios/Pods
      rm ios/Podfile.lock
      cd ios && pod install && cd ..
      
  3. 删除并重建模拟器设备
    • 打开Xcode,进入Window > Devices and Simulators,选中故障模拟器右键选择Delete,再重新添加同型号模拟器。
  4. 指定模拟器运行应用
    • 先执行flutter devices获取目标模拟器ID,再运行:
      flutter run -d <模拟器ID>
      
  5. 终止残留进程
    • 打开活动监视器,搜索并终止所有包含com.myPackageName.Dev或Flutter的相关进程,再重新运行应用。

内容的提问来源于stack exchange,提问作者Wahab Khan Jadon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 01:30:12