0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Flutter】Windows環境からiOSアプリをCodemagicでテストする方法 🚀

Posted at

Codemagicとは:
・Windows環境からでもMacなしでiOSビルドが可能
・GitHub/GitLabなどと簡単に連携
・無料プランで手軽にスタート可能

🔍 必要なもの
・Windows PC
・Flutterアプリのリポジトリ(GitHubなど)
・Codemagicのアカウント(無料で登録可能)

🛠 CodemagicでiOSシミュレーター向けにビルドする手順
① Codemagicとリポジトリを連携する
Codemagicにログインし、Flutterアプリのリポジトリを登録します。
https://codemagic.io/start/

Codemagicで「Add Application」を選択
GitHubなどで認証し、リポジトリを選択
② codemagic.yamlの設定
Flutterプロジェクトのルートに以下のcodemagic.yamlを作成します。

workflows:
  ios-simulator-test:
    name: iOS Simulator Test
    environment:
      flutter: stable
      xcode: latest
    scripts:
      - flutter packages pub get
      - flutter analyze
      - flutter test
      - flutter build ios --simulator --debug --no-codesign
    artifacts:
      - build/ios/iphonesimulator/*.app

この設定で、Codemagic上でシミュレーター用のiOSアプリが作成されます。
③ 変更をコミットしてGitHubにプッシュ
作成したファイルをコミット・プッシュします。

git add codemagic.yaml
git commit -m "Add codemagic.yaml for iOS simulator test"
git push origin main

④ Codemagicでビルドを開始 🎯
Codemagicで以下を行います。

「Start new build」をクリック
ワークフローを選択(ios-simulator-test)
「Start new build」を再度クリックしてビルドを開始
Codemagicがクラウド上でiOSシミュレーター向けアプリを生成します。

image.png

🌟 Windowsで動作確認をする方法
ビルドが成功すると、iOSシミュレーター用の.appファイルが生成されます。

Windows環境から手軽に確認するには Appetize.io がおすすめです。

📱 Appetize.ioを使ってブラウザで確認
Codemagicで生成した.appフォルダをZip圧縮してダウンロード
https://appetize.io/
にアクセス
zipファイルをアップロードして起動
ブラウザ上ですぐにシミュレーターが起動し、アプリの動作を手軽に確認できます。

image.png

🚩 注意点
Codemagicの無料枠にも一定の時間制限(500分/月)がありますが、個人開発には十分です。

‼️補足
こんなエラーが出ました。

Error: The plugin "firebase_core" requires a higher minimum iOS deployment version than your application is targeting.
To build, increase your application's deployment target to at least 13.0 as described at https://flutter.dev/to/ios-deploy
Error running pod install

Podfile をiosフォルダ以下に格納する必要があるのですが、
そのためにはpodコマンドを使用する必要があります。
しかし、Windowsからでは使用できないので、LinuxとかMac OSの使用が必要となります。

これを回避するために、CursorでPodfileを生成してもらうと便利です。
image.png

これに付随して、必要に応じてpbxprojファイル等も変更してくれるので、便利🎉

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?