🤖

【Flutter】【Fastlane】MacOS15.4 更新後、iOSアップロードできない状態 の対応

に公開

経緯

MacOSを更新後に、Fastlaneでアップロード処理をしても、ビルドが反映されず、困った。
が、
Appleから「Action needed: ...」のメールが来ていて気づいた。

// 件名
Action needed: The uploaded build for {YOUR APP} has one or more issues.

// 本文
ITMS-90048: This bundle is invalid - Your archive contains paths that are not allowed: [._Symbols]

※ちなみに、Fastlane上のログは、
Waiting for... が、繰り返されるだけで、最後はタイムアウトエラーなので、気付きずらい。。

Waiting for processing on... app_id: 1234567890, app_version: 0.0.1, build_version: 1, platform: IOS
Waiting for processing on... app_id: 1234567890, app_version: 0.0.1, build_version: 1, platform: IOS
Waiting for processing on... app_id: 1234567890, app_version: 0.0.1, build_version: 1, platform: IOS
Waiting for processing on... app_id: 1234567890, app_version: 0.0.1, build_version: 1, platform: IOS
Waiting for processing on... app_id: 1234567890, app_version: 0.0.1, build_version: 1, platform: IOS
...

原因

MacOSの更新の影響で、flutterのipa作成時に、不要なファイル(._Symbols)ができてしまい、それが原因でipaアップロードが、エラーとなるようでした。

対応

該当のGithubのIssue(※1)を参考。

1, Fastfileに、対応処理(lane)を追加

 # refs: https://github.com/flutter/flutter/issues/166367#issuecomment-2786362223
 desc "Temporary workaround to remove unwanted files from the IPA"
  private_lane :temporary_fix_ios_post_build do
    # Workaround to remove ._Symbols from ipa.
    ipa_location = lane_context[SharedValues::IPA_OUTPUT_PATH]
    sh("unzip -l #{ipa_location} | grep ._Symbols || true")
    sh("zip -d #{ipa_location} ._Symbols/ || true")
  end

2, Fastfileのipa作成処理の直後に対応処理を追加

これを、fastlaneで、ipa作成する処理(※下記はbuild_app()を利用時)の後に、呼ぶことで対応。

build_app(
      workspace: "Runner.xcworkspace",
      scheme: "Runner",
      clean: true,
      silent: true,
      export_options: {
        signingStyle: "automatic",
        method: "app-store"
      },
    )

# --- build_app()の直後に対応処理を追加 ---
# 作成されたipaに含まれる不要ファイルを削除する一時的な対応
temporary_fix_ios_post_build() # NOTE: MacOS 15.4からのエラー対応
    

備考

追加した対応処理は、不要なファイルがなかったら処理が走らないようになっているので、安全だが、次のMacOS更新や、Flutter更新?でなおっていたら、削除はする予定。


※...1
https://github.com/flutter/flutter/issues/166367
https://github.com/flutter/flutter/issues/166367#issuecomment-2786362223

Discussion