iOS17にアップデートしたらFlutterの実機デバッグが出来なくなったのを何とかした話

Flutterで個人開発しているアプリのデバッグを実機で行っていました。
先日までiOS15だったのですが、先日アップデートのお知らせがあり、デバイスをiOS17にアップデートした後にVScodeのデバッグボタンを押したところ・・・。

The Dart VM Service was not discovered after 75 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.

Click “Allow” to the prompt asking if you would like to find and connect devices on your local network. This is required for wireless debugging. If you selected “Don’t Allow”, you can turn it on in Settings > Your App Name > Local Network. If you don’t see your app in the Settings, uninstall the app and rerun to see the prompt again.

こんなエラーが発生して、それまで問題なく行えていた実機でのデバッグが出来なくなってしまった。

解決した方法

  • Xcodeのバージョンを15に上げた。
  • PCをMacOS14にバージョンアップした。

そのうえで、Flutterプロジェクトのディレクトリで下のコードを実行

flutter clean
flutter pub get
cd ios
rm -rf Pods
pod update
pod install
cd ..

それから、XcodeのRunボタンをクリック

Xcodeで起動が成功したら、VScodeのデバッグ設定ファイルlanch.jsonに下記のように設定する

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Flutter (attach)",
      "request": "attach",
      "type": "dart",
    }
  ]
}
追記したら、「Flutter(attach)」を選択してVScodeのデバッグ開始ボタンを押す
これでiOS17でも実機デバッグとホットリロードが問題なくできるようになりました。