【Flutter】xcodebuild: error: Unable to find a destination matching the provided destination specifier が出た時の対処法

Dart

概要

どうも、@daiki1003です!

Flutterを開発していて、iOS実機ビルドしようとした際に掲題のエラーが発生しました。
解決までの道のりを備忘録的に示していこうと思います。

🤯 エラー内容

全文は以下に記しています。

Launching lib/main.dart on ashdik in debug mode...Found saved certificate choi - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

抜粋

Launching lib/main.dart on ashdik in debug mode...
Found saved certificate choice "Apple Development: ${My Name} (xxxxxxxxxx)". To clear, use "flutter config".
Signing iOS app for device deployment using developer identity: "Apple Development: xxxxxxxxxx${My Name} (xxxxxxxxxx)"

(中略)

    xcodebuild: error: Unable to find a destination matching the provided destination specifier:
    		{ id:${UDID} }
    	The requested device could not be found because no available devices matched the request.
    	Available destinations for the "Development" scheme:
    		{ platform:iOS Simulator, id:031F2398-4949-44E8-A2C4-85CB4FB7A3BB, OS:15.4, name:iPad (9th generation) }
                ...
    		{ platform:iOS Simulator, id:87638E22-E88B-4D58-AAC2-BDF27C96EF9B, OS:15.4, name:iPod touch (7th generation) }
    	Ineligible destinations for the "Development" scheme:
    		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    		{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    		{ platform:iOS, id:${UDID}, name:ashdik, error:Device is busy (Preparing the watch for development via ashdik) }

🔨 解決

TL;DR

・証明書に紐づく適切なprovisioning profilesがないよ
Flutterは前回選んだ証明書を記憶している
flutter config --clear-ios-signing-cert実行後、再チャレンジしてみよう
・それでもダメなら端末再起動してみよう

Xcodeからビルドしてみる

成功する→Flutterの問題と判明

リスタート系

$ rm pubspec.lock; rm ios/Podfile.lock; rm -rf ios/Pods
$ flutter clean
$ flutter pub get

からの実行ではだめ

VSCodeのリスタートもだめ

flutter config

$ flutter config

Configure Flutter settings.

To remove a setting, configure it to an empty string.

(中略)

Settings:
  enable-macos-desktop: true
  ios-signing-cert: Apple Development: ${My Name} (xxxxxxxxxx)

Analytics reporting is currently enabled.

まず、このxxxxxxxxxxの部分が本来使いたかった証明書ではなかったことが判明!

$ flutter config --clear-ios-signing-cert

を叩いてクリアします。

その後、再度

$ flutter run ${この辺は各自適切な引数を}

を叩きました。

途中、証明書を選べと言われるので適切な方を選ぶ。

これで解決しているはず!

端末の再起動

もし、上記コマンドでもダメだったら端末を再起動してみましょう。

ちなみに、この時 flutter run --verboseを実行してみると

! Error: ashdik is busy: Preparing the watch for development via ashdik. Xcode will continue when ashdik is finished. (code -10)

注:ashdikは端末の名前です笑

と出ていました。

誰かのお役に立てば。

Twitterフォローお願いします

「次回以降も記事を読んでみたい!」
「この辺分からなかったから質問したい!」

そんな時は、是非Twitter (@daiki1003)Instagram (@ashdik_flutter)のフォローお願いします♪

Twitterコミュニティ参加お願いします

Twitterコミュニティ「Flutter lovers」を開設しました!
参加お待ちしております😁

☕️ Buy me a coffee

また、記事がとても役に立ったと思う人は
コーヒーを奢っていただけると非常に嬉しいです!
@daiki1003

コメント

タイトルとURLをコピーしました