Fastlane Match利用中にProvisioning ProfileをApple Developer Program上で誤って削除しちゃったら


Apple Developer Program上で複数のApp IDを管理してると、期限切れや利用不可の証明書とProvisioning Profileを一掃してくれるコマンドfastlane match nukeが使えなくてハマったのでメモです

前提

  • Fastlane Matchで証明書/Provisioning Profileを管理
  • 1つのApple Developerアカウントで複数のアプリ(App ID)を管理

現象

Fastlane Matchで生成されたProvisioning ProfileをApple Developer Programで直接削除したら、

$ fastlane match development

コマンドを実行したときに以下のエラーが出てきた

[15:50:22]: Provisioning profile 'XXXXX' is not available on the Developer Portal
[15:50:22]: for the user [email protected]
[15:50:22]: Make sure to use the same user and team every time you run 'match' for this
[15:50:22]: Git repository. This might be caused by deleting the provisioning profile on the Dev Portal

[!] To reset the provisioning profiles of your Apple account, you can use the fastlane match nuke feature, more information on https://docs.fastlane.tools/actions/match/

fastlane match nukeを実行すれば解決するよ」とは教えてくれるが、私の環境ではnukeはできない。
なぜならば、Apple Developer Program上で複数種類のApp IDを管理している状態だと、nukeはApp ID関係なくあらゆる期限切れの証明書やProvisioning profileを削除しちゃうから使えない。(関係ないApp ID関連の物まで消しちゃう)

対応

Matchfilegit_url("[email protected]:XXX/XXX.git)で指定してるプライベートレポジトリ上で、Developer Program上で消してしまったProvisioning profileを直接削除すると、matchコマンドがまた使えるようになる

参考URL