😑

flutter build iosでエラーになった人が読む記事

2024/05/24に公開

flutter build iosでエラー

iOSアプリをリリースする過程でflutter build iosコマンドを実行したら、盛大にエラーになりました。
エラーメッセージの通りにやっていけば解決しますが、英語ですし、少し迷ったところもあったので記事を書きました。

════════════════════════════════════════════════════════════════════════════════
No valid code signing certificates were found
You can connect to your Apple Developer account by signing in with your Apple ID
in Xcode and create an iOS Development Certificate as well as a Provisioning 
Profile for your project by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again
  5- Trust your newly created Development Certificate on your iOS device
     via Settings > General > Device Management > [your new certificate] > Trust

For more information, please visit:
  https://developer.apple.com/library/content/documentation/IDEs/Conceptual/
  AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
No development certificates available to code sign app for device deployment

1- Open the Flutter project's Xcode target with

Xcodeでプロジェクトのios/Runner.xcworkspaceを指定してプロジェクトを開きます。

2- Select the 'Runner' project in the navigator then the 'Runner' target

左のメニューバーからRunnerを選択します。

3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.

私はここで選択されていたTeamとBundle Identifierが誤っていました。

このとき、以下の指示を満たす必要があります。

     You may need to:
         - Log in with your Apple ID in Xcode first
            →Xcode>Settings>Accountsで正しいAppleIDを追加
         - Ensure you have a valid unique Bundle ID
            →Bundle Identifierの確認
         - Register your device with your Apple Developer Account
            →Apple Developer Accountにデバイスを登録
         - Let Xcode automatically provision a profile for your app
            →これはよくわからないけどなにもしなかった

Bundle Identifierの確認方法
https://zenn.dev/captain_blue/articles/checking-bundle-id-in-flutter

Device ID (UUID)の確認方法(デバイス登録時)
https://monobook.org/wiki/MacのDevice_ID_(UUID)を調べる

4- Build or run your project again

flutter build ios

成功!

Discussion