Closed57

もくまっち開発 Week 12

光岡 高宏光岡 高宏
  • ちーろってぃさんに Certificate 登録できるようにする

こっちから。

光岡 高宏光岡 高宏

証明書は下記などがある。
後者はチームで 1 つしか発行できず、管理者が発行して運用するのが良い。

  • Apple Development 証明書(開発用証明書)
    • 開発中にデバイス上で iOS アプリを実行するための証明書
    • iOS アプリ用に 2 つ発行できる
  • Apple Distribution 証明書(配布用証明書)
    • テスト用に iOS アプリを App Store Connect にアップロードするための証明書
    • チームで 1 つしか発行できない
光岡 高宏光岡 高宏
  • ちーろってぃさんに Certificate 登録できるようにする

ということで、これは僕が管理者になったので不要になった。

光岡 高宏光岡 高宏
  • ちーろってぃさんに Certificate 登録できるようにする
  • iOS ビルドの証明書周りの設定(先週積み残し)
  • GitHub Actions でテストフライト公開する準備(1/2) (先週積み残し)
  • Google Play でテストアプリ使えるようにする
光岡 高宏光岡 高宏
  • GitHub Actions でテストフライト公開する準備(1/2) (先週積み残し)

次はこれ。

光岡 高宏光岡 高宏

先週はこんな状態で終わったので p12 ファイル というのを作っていく

  • APPLE_APP_PASS (App 用 パスワード)
  • APPLE_ID (Apple ID)
  • CERTIFICATES_P12 (p12 ファイル)
  • CERTIFICATE_PASSWORD (p12 ファイルのパスワード)
  • PROVISIONING_PROFILE (Provisioning profile)

https://zenn.dev/link/comments/a63e8b9775b583

光岡 高宏光岡 高宏
  • CERTIFICATES_P12 (p12 ファイル)
  • CERTIFICATE_PASSWORD (p12 ファイルのパスワード)

この 2 つも設定した

  • APPLE_APP_PASS (App 用 パスワード)
  • APPLE_ID (Apple ID)
  • CERTIFICATES_P12 (p12 ファイル)
  • CERTIFICATE_PASSWORD (p12 ファイルのパスワード)
  • PROVISIONING_PROFILE (Provisioning profile)
光岡 高宏光岡 高宏

その前に Xcode の Archive から ExportOptions.plist というファイルを取ってくる

光岡 高宏光岡 高宏

エラーになった

Run flutter build ipa --export-options-plist=ExportOptions.plist --build-number ${GITHUB_RUN_NUMBER}
  flutter build ipa --export-options-plist=ExportOptions.plist --build-number ${GITHUB_RUN_NUMBER}
  shell: /bin/bash -e {0}
Downloading ios tools...                                            4.6s
Downloading ios-profile tools...                                    3.1s
Downloading ios-release tools...                                 2,940ms

Archiving studio.protoout.miliconvalley.mochmatch...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9Z99MR8XP3
Running pod install...                                            539.3s
Running Xcode build...                                          
Xcode archive done.                                         21.3s
Failed to build iOS app
Error (Xcode): No profiles for 'studio.protoout.miliconvalley.mochmatch' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'studio.protoout.miliconvalley.mochmatch'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
/Users/runner/work/mochmatch/mochmatch/ios/Runner.xcodeproj


It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem.
Encountered error while archiving for device.
Error: Process completed with exit code 1.
光岡 高宏光岡 高宏

Gemini の回答


エラーの原因と解決策
エラーメッセージは、アプリのバンドルIDに一致するiOS App Developmentプロビジョニングプロファイルが見つからないことを示しています。これは、アプリがデバイスにインストール前に署名できないことを意味します。

この問題を解決するには、以下の手順に従ってください。

1. バンドルIDの確認

Xcodeで ios/Runner.xcworkspace ファイルを開きます。
アプリのターゲット(通常は "Runner")に移動します。
ターゲット設定の General タブで Bundle Identifier フィールドを確認 します。
Apple Developer Portal の署名 ID と一致 していることを確認します。
2. 自動署名の有効化(オプション)

バンドルIDが正しい場合は、flutter build ipa で使用される xcodebuild コマンドに -allowProvisioningUpdates フラグを追加することで自動署名を有効化できます。これは、ビルドスクリプトを編集するか、IPA のビルドにカスタムコマンドを使用することで実現できます。
-allowProvisioningUpdates フラグ付きの修正コマンド:

flutter build ipa --export-options-plist=ExportOptions.plist --build-number ${GITHUB_RUN_NUMBER} --allow-provisioning-updates
重要な注意事項: 自動署名を有効にすると、新しいプロビジョニングプロファイルが作成される場合があります。プロファイルを作成するには、Apple Developer Portal 内で必要な権限とアクセス権を持っていることを確認してください。

3. 手動プロビジョニングプロファイル(上級者向け)

自動署名が必要ない場合は、Apple Developer Portal から手動でプロビジョニングプロファイルをダウンロードし、Xcode で設定できます。これはより複雑なプロセスであり、Apple デベロッパーツールの詳細な知識が必要です。
参考資料:

https://docs.flutter.dev/deployment/ios
https://developer.apple.com/support/certificates/
これらの手順に従うことで、署名に関する問題を解決し、IPA を正常にビルドできるはずです。さらに問題が発生した場合は、オンラインリソースを検索したり、Flutter コミュニティに支援を求めたりすることを検討してください。
光岡 高宏光岡 高宏
  1. バンドルIDの確認

Xcodeで ios/Runner.xcworkspace ファイルを開きます。
アプリのターゲット(通常は "Runner")に移動します。
ターゲット設定の General タブで Bundle Identifier フィールドを確認 します。
Apple Developer Portal の署名 ID と一致 していることを確認します。

こちらを確認してみる

光岡 高宏光岡 高宏

Apple Developer Portal の署名 ID と一致 していることを確認します。

これがわからん

光岡 高宏光岡 高宏
Apple Developer Portal で署名 ID を確認するには、以下の手順に従ってください。

1. Apple Developer Portal にログイン

https://developer.apple.com/ にアクセスします。
右上の "サインイン" をクリックします。
Apple ID とパスワードを入力してログインします。
2. 証明書、ID、プロファイルページに移動

左側のナビゲーションバーで "アカウント" をクリックします。
"証明書、ID、プロファイル" をクリックします。
3. 署名 ID を確認

"iOS" タブをクリックします。
左側のリストから "App IDs" を選択します。
アプリの "App ID" をクリックします。
"Signing & Capabilities" セクションで "Development" または "Distribution""Team" ドロップダウンリストを確認します。
ドロップダウンリストに表示されている チームID が、Xcode で確認した Bundle Identifier と一致していることを確認します。
4. 詳細な確認

さらに詳細を確認するには、"証明書" タブをクリックし、"Development" または "Distribution""iOS Development" または "iOS Distribution" 証明書を選択します。
証明書の詳細画面で "Subject" フィールドを確認します。
"Subject" フィールドには、"CN= ..." 形式で Bundle Identifier が含まれている必要があります。
ヒント:

複数のチームに所属している場合は、正しいチームを選択していることを確認してください。
以前作成した署名 ID を使用している場合は、有効期限が切れていないことを確認してください。
参考資料:

[無効な URL を削除しました]
これらの手順で、Apple Developer Portal で署名 ID を確認できるはずです。
光岡 高宏光岡 高宏

"iOS" タブがない

以前の回答で、"iOS" タブをクリックするよう指示しましたが、これは誤りでした。正しくは "証明書" タブをクリックする必要があります。

お詫び申し上げます。

正しい手順:

Apple Developer Portal にログインします。
左側のナビゲーションバーで "アカウント" をクリックします。
"証明書、ID、プロファイル" をクリックします。
"証明書" タブをクリックします。
"Development" または "Distribution""iOS Development" または "iOS Distribution" 証明書を選択します。
証明書の詳細画面で "Subject" フィールドを確認します。
"Subject" フィールドには、"CN= ..." 形式で Bundle Identifier が含まれている必要があります。
ヒント:

複数のチームに所属している場合は、正しいチームを選択していることを確認してください。
以前作成した署名 ID を使用している場合は、有効期限が切れていないことを確認してください。
参考資料:

Apple Developer Documentation - Provisioning Profiles: [無効な URL を削除しました]
この修正により、Apple Developer Portal で署名 ID を正しく確認できるようになることを願っています。

嘘つかれた

光岡 高宏光岡 高宏

Apple Distribution ではなくて、 iOS Distribution じゃないとダメ説

1. 証明書の種類:

確認している証明書が "iOS Development" または "iOS Distribution" 証明書であることを確認してください。
他の種類の証明書 (: "Apple Worldwide Developer Relations Certificate") では、CN フィールドが存在しない場合があります。
光岡 高宏光岡 高宏

Apple Distribution ではなくて、 iOS Distribution じゃないとダメ説

1. 証明書の種類:

確認している証明書が "iOS Development" または "iOS Distribution" 証明書であることを確認してください。
他の種類の証明書 (: "Apple Worldwide Developer Relations Certificate") では、CN フィールドが存在しない場合があります。
光岡 高宏光岡 高宏

iOS Distribution で発行した証明書をキーチェーンアクセスに登録しても、秘密鍵が表示されない

光岡 高宏光岡 高宏

エラーメッセージちゃんと読も。

Error (Xcode): No profiles for 'studio.protoout.miliconvalley.mochmatch' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'studio.protoout.miliconvalley.mochmatch'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
/Users/runner/work/mochmatch/mochmatch/ios/Runner.xcodeproj


It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem.
Encountered error while archiving for device.
Error: Process completed with exit code 1.
光岡 高宏光岡 高宏

studio.protoout.miliconvalley.mochmatch にマッチする iOS App Development provisioning profiles が見つからないと。

光岡 高宏光岡 高宏

編集したら Certificates が選べるようになってたので、 DistributionApple Distribution の方だと思われる)を選択。

光岡 高宏光岡 高宏

前にメモってた

  • 1 つのプロビジョニングプロファイルには下記が含まれている
    • [[Explicit App ID]]: 1 つまたは複数
    • [[Certificate]]: 1 通

Provisioning ProfileCertificate に依存してるから
Certificate を変更したら Provisioning Profile もアップデートしないといけないということだったのか

光岡 高宏光岡 高宏

GitHub Actions Secret の PROVISIONING_PROFILE 更新済み。
もう一回実行してみる

光岡 高宏光岡 高宏

無念

Error (Xcode): No profiles for 'studio.protoout.miliconvalley.mochmatch' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'studio.protoout.miliconvalley.mochmatch'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
/Users/runner/work/mochmatch/mochmatch/ios/Runner.xcodeproj
It appears that there was a problem signing your application prior to installation on the device.
Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace
Also try selecting 'Product > Build' to fix the problem.
Encountered error while archiving for device.
Error: Process completed with exit code 1.

同じエラーメッセージ。やっぱ iOS Distribution じゃないとダメなのかな

光岡 高宏光岡 高宏

やっぱ iOS Distribution だと秘密鍵( p12 ファイル)が生成できないんだよな

光岡 高宏光岡 高宏
証明書署名要求(CSR)   = 公開鍵 + 開発者の情報 ・・・(1)
証明書(Certificate)   = CSR + Appleの署名・・・(2)
Siging Identity(p12) = 公開鍵 + 秘密鍵(開発者本人しか持っていないはず)・・・(3)
Provisioning Profile = AppID + Certificate + DeviceID List・・・(4)

# (4)は展開できる
Provisioning Profile = AppID + Certificate + DeviceID List
                     = AppID + CSR + Appleの署名 + DeviceID List # (2)より
		     = AppID + 公開鍵 + 開発者の情報 + Appleの署名 + DeviceID List # (1)より
光岡 高宏光岡 高宏

やっぱ iOS Distribution だと秘密鍵( p12 ファイル)が生成できないんだよな

ググったらこういう記事が。

https://flowone.hatenablog.com/entry/2024/01/22/082001

ダウンロードしたAPNsファイルを手順通りにダブルクリックするのではなく、無理やりマウスでドラッグして「My Certificate(自分の証明書)」にドロップしたら、なんとちゃんと読み込まれました。

僕の場合はこちらではうまくいかず。

光岡 高宏光岡 高宏
  • ちーろってぃさんに Certificate 登録できるようにする
  • iOS ビルドの証明書周りの設定(先週積み残し)
  • GitHub Actions でテストフライト公開する準備(1/2) (先週積み残し)
  • Google Play でテストアプリ使えるようにする

今週も完遂ならず。
来週もかけて GitHub Actions でテストフライト自動公開されるようにしよう。

このスクラップは2ヶ月前にクローズされました