😹

iPhone実機デバッグ時「Failed to prepare device for development. This ...」の解決

2022/05/18に公開

Flutterプロジェクトの開発中、iPhoneが認識されず実機検証で躓いたナレッジを共有したいと思います。

FlutterSDKで実機が認識されない

カメラ周りのテストをしたいと思い、(AndroidStudio上の)デバイス一覧を確認しても接続したiPhoneの名前がない...
flutter devices device-id で確認しても表示されないためXcodeで確認すると認識されていました。

恐る恐るビルドすると

Failed to prepare device for development.
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility. 

見事にエラーを吐き、インストールできませんでした。macOSやXcode、iOSも最新なのにdeviceのversionが悪いというね....

解決策

macを再起動しましょう😆

AppleのDeveloper Forumsで同様のエラーに対する質問があり、macを再起動したらビルドできたという先行事例がありました。
実際に試したところ、FlutterSDKが実機を認識し正常にビルドすることができました。

GitHubで編集を提案

Discussion