错误场景
更新了IOS的系统版本为最新的17.0, 运行报以下错误
Launching lib/main.dart on iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: GN3DCAF71C Running Xcode build... Xcode build done. 10.3s Installing and launching... Could not run build/ios/iphoneos/Runner.app on 00008101-000465E821FA001E. Try launching Xcode and selecting "Product > Run" to fix the problem: open ios/Runner.xcworkspace Error launching application on iPhone.
网上的解决方案
在网上上到一种方法
1. run "flutter clean" on flutter project 2. in xcode -> build -> clean 3. run "flutter build bundle"
试一下发现不是一样的问题。
实际解决方案
最后在stackoverflow上找到解决办法=>链接地址
根本原因是IOS17和Xcode的配置变化引起的,需要更新Flutter的SDK版本到3.13以上就可以解决。
在命令行中使用flutter upgrade
来更新Flutter sdk。
ado@adodeMacBook-Air ~ % flutter upgrade Upgrading Flutter to 3.16.2 from 3.10.6 in /Users/ado/work/dev_env/flutter... Downloading Darwin arm64 Dart SDK from Flutter engine cf7a9d0800f2a5da166dbe0eb9fb2476018269b1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 2 207M 2 4399k 0 0 7378k 0 0:00:28 --:--:-- 0:00:28 7419k 6 207M 6 14.1M 0 0 9174k 0 0:00:23 0:00:01 0:00:22 9193k 11 207M 11 23.9M 0 0 9507k 0 0:00:22 0:00:02 0:00:20 9517k 16 207M 16 34.4M 0 0 9889k 0 0:00:21 0:00:03 0:00:18 9898k 21 207M 21 44.0M 0 0 9869k 0 0:00:21 0:00:04 0:00:17 9875k 26 207M 26 54.3M 0 0 9966k 0 0:00:21 0:00:05 0:00:16 10.0M 31 207M 31 64.5M 0 0 9.7M 0 0:00:21 0:00:06 0:00:15 10.0M 36 207M 36 74.8M 0 0 9.8M 0 0:00:20 0:00:07 0:00:13 10.1M 41 207M 41 85.0M 0 0 9.8M 0 0:00:20 0:00:08 0:00:12 10.0M 45 207M 45 94.7M 0 0 9.9M 0 0:00:20 0:00:09 0:00:11 10.1M 50 207M 50 104M 0 0 9.8M 0 0:00:21 0:00:10 0:00:11 9.9M 55 207M 55 113M 0 0 9.8M 0 0:00:21 0:00:11 0:00:10 9.8M 59 207M 59 123M 0 0 9.8M 0 0:00:21 0:00:12 0:00:09 9913k 64 207M 64 132M 0 0 9.7M 0 0:00:21 0:00:13 0:00:08 9804k 68 207M 68 140M 0 0 9899k 0 0:00:21 0:00:14 0:00:07 9436k 72 207M 72 150M 0 0 9906k 0 0:00:21 0:00:15 0:00:06 9544k 77 207M 77 159M 0 0 9872k 0 0:00:21 0:00:16 0:00:05 9408k 81 207M 81 169M 0 0 9862k 0 0:00:21 0:00:17 0:00:04 9421k 86 207M 86 178M 0 0 9843k 0 0:00:21 0:00:18 0:00:03 9388k 90 207M 90 188M 0 0 9826k 0 0:00:21 0:00:19 0:00:02 9616k 94 207M 94 195M 0 0 9721k 0 0:00:21 0:00:20 0:00:01 9142k 97 207M 97 202M 0 0 9611k 0 0:00:22 0:00:21 0:00:01 8745k 100 207M 100 207M 0 0 9609k 0 0:00:22 0:00:22 --:--:-- 8611k Building flutter tool... Resolving dependencies... Got dependencies. Upgrading engine... Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Downloading android-arm-profile/darwin-x64 tools... 422ms Downloading android-arm-release/darwin-x64 tools... 437ms Downloading android-arm64-profile/darwin-x64 tools... 323ms Downloading android-arm64-release/darwin-x64 tools... 504ms Downloading android-x64-profile/darwin-x64 tools... 309ms Downloading android-x64-release/darwin-x64 tools... 284ms Downloading android-x86 tools... 1,292ms Downloading android-x64 tools... 1,850ms Downloading android-arm tools... 1,238ms Downloading android-arm-profile tools... 806ms Downloading android-arm-release tools... 536ms Downloading android-arm64 tools... 6.9s Downloading android-arm64-profile tools... 837ms Downloading android-arm64-release tools... 631ms Downloading android-x64-profile tools... 868ms Downloading android-x64-release tools... 528ms Downloading android-x86-jit-release tools... 1,362ms Downloading ios tools... 9.1s Downloading ios-profile tools... 8.9s Downloading ios-release tools... 6.1s Downloading Web SDK... 5.8s Downloading package sky_engine... 141ms Downloading flutter_patched_sdk tools... 426ms Downloading flutter_patched_sdk_product tools... 392ms Downloading darwin-arm64 tools... 2,841ms Downloading darwin-x64/FlutterMacOS.framework tools... 3.2s Downloading darwin-x64/gen_snapshot tools... 618ms Downloading darwin-x64-profile/FlutterMacOS.framework tools... 1,642ms Downloading darwin-x64-profile tools... 302ms Downloading darwin-x64-profile/gen_snapshot tools... 610ms Downloading darwin-x64-release/FlutterMacOS.framework tools... 1,102ms Downloading darwin-x64-release tools... 277ms Downloading darwin-x64-release/gen_snapshot tools... 547ms Downloading darwin-arm64/font-subset tools... 165ms Flutter 3.16.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 9e1c857886 (14 hours ago) • 2023-11-30 11:51:18 -0600 Engine • revision cf7a9d0800 Tools • Dart 3.2.2 • DevTools 2.28.3 Running flutter doctor... Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.2, on macOS 14.1.2 23B92 darwin-arm64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.84.1) [✓] Connected device (3 available) [✓] Network resources • No issues found!
等待更新完成后,flutter doctor
中没有提示其他错误了,直接run就能正常了。