iOS アプリをシミュレーターでテスト
TLDR AI は、開発者が iOS アプリをシミュレーター上で効率的にテストするための具体的な手法とベストプラクティスを解説している。
キーポイント
シミュレーターの最適化設定
テストの速度と精度を高めるためのデバイス、OS バージョン、およびネットワーク条件の適切な構成方法について詳述している。
自動化テストの実装戦略
Xcode のインテグレーションやスクリプトを活用し、手動テストに依存しない効率的な自動検証フローの構築方法を提示している。
リアルタイムデバッグ手法
シミュレーター上で発生する不具合を迅速に特定・修正するためのログ解析やパフォーマンス計測のテクニックを紹介している。
重要な引用
Efficient testing in the simulator is crucial for rapid iteration.
Leveraging Xcode's built-in tools can significantly reduce debugging time.
影響分析・編集コメントを表示
影響分析
この記事は、iOS 開発者が開発サイクルを短縮し、コストを削減するための具体的な実践的ガイダンスを提供しています。特に、シミュレーターを活用した効率的なテスト戦略は、小規模チームから大企業まで幅広く適用可能な価値のある知見です。
編集コメント
AI モデルや生成技術の直接的な進歩を報じる記事ではありませんが、開発現場における生産性向上のための重要な実務知識を提供しています。シミュレーター活用は AI ツールの導入以前に不可欠な基礎スキルであり、その重要性を再認識させる内容です。
Claude Code Desktop の会話画面の隣には、Apple の iOS Simulator でアプリを実行している様子が表示される「iOS Simulator パネル」があります。Claude がシミュレーター上でアプリをビルド、インストール、起動、または検証する際、このパネルは自動的に開き、デバイスの画面がリアルタイムでストリーミングされます。Claude がアプリを実行・テストしている様子を見守ったり、Claude が作業を続ける中で自分でもアプリをタップして操作したりするために活用できます。
このシミュレーターパネルはシミュレーターに直接接続するため、computer use の機能は必要なく、画面全体を占有したり他のウィンドウを隠したりすることはありません。一方、CLI(コマンドライン)から操作する場合は computer use を介して iOS Simulator にアクセスし、マウスで操作する場合と同様に、画面上のシミュレーターを制御します。
要件
このシミュレーターパネルは Apple のシミュレーターツールを使用しますが、デスクトップアプリには標準では含まれていません。セッションを開始する前に、以下の環境が整っていることを確認してください。
- Claude Desktop バージョン v1.24012.0 以降
- Mac(Apple の iOS Simulator は macOS 上でのみ動作するため)
- iOS プラットフォームがインストールされた Xcode。これによりシミュレーターデバイスが利用可能になります。Xcode でまだシミュレーターが見つからない場合は、「シミュレーターが見つかりません」と表示される場合の対処法を参照してください。
必ず JSON 形式で返してください。translation フィールドのみ。他のフィールドは一切追加しないこと — 余計なフィールドを書こうとして本文がトークン上限で打ち切られる事故を防ぐため:
{"translation": "リライト全文"}
シミュレータペインはローカルセッションでのみ利用可能です。クラウド や SSH セッションでは、Claude が動作するマシンが Mac 上のシミュレータにアクセスできないためです。
シミュレータでアプリを実行する
シミュレータペインを開くためのコマンドや設定は不要です。Claude がシミュレータ上でアプリを実行すると、自動的にペインが開かれます。
1
2
3
Claude がセッションの任意の時点でシミュレーター上でアプリを起動すると、シミュレーターペインが開きます。例えば「新しい画面は正しく表示されているか?」のようにアプリの動作確認を求めた場合、Claude は作業を開始する前にシミュレーターを起動します。バグ修正や画面変更を行った後は、その変更を検証するよう依頼してください。アプリを再起動すれば、ペインが閉じていた場合でも自動的に開きます。
シミュレーターペインには、実際にアプリが起動されたデバイスの情報が表示されます。特定のデバイスでテストしたい場合は、「iPhone SE シミュレーターで実行して」といったようにリクエストに指定してください。Claude はそのデバイスに合わせてビルドと起動を行います。
Claude が起動したデバイスは、Apple の Simulator アプリにも表示されます。また、すでに起動済みのデバイスにアプリをインストールすることも可能です。
ユーザー側からシミュレーターペインを手動で開くこともできます。セッションにシミュレーターが接続されているか、Swift ファイルの編集が行われている場合、セッションツールバーのViewsメニューにiOS Simulatorという項目が表示されます。まだデバイスが表示されていない場合は、Attach simulatorをクリックするか、その隣にあるデバイスメニューから特定のデバイスを選択してください。シャットダウン状態のデバイスを選んだ場合、自動的に起動します。Xcode やそのシミュレーターが見つからない場合は、セットアップ手順が表示され、各ステップを完了するごとにチェックが入ります。
シミュレーターを自分で操作する
シミュレーターペインは単なる表示画面ではなく、直接操作できます。Claude が作業中であっても、タスクの間隔でも以下のような操作が可能です:
- デバイス画面上でクリックしてドラッグすることで、タップやスワイプ操作を行う
Apple の Simulator アプリと同じショートカットキーを使って、ハードウェアボタンを操作できます。Home ボタンは Cmd+Shift+H、ロック画面への切り替えは Cmd+L、音量調整には Cmd+上矢印と Cmd+下矢印を使用します。
回転ボタンまたは Cmd+Right Arrow で、デバイスを 90 度右に回転させることができます。
デバイスメニューから表示する端末を切り替えます。このメニューでは、各シミュレーターの OS バージョンや起動状態を確認できます。
Cmd+S または Cmd+R を押すか、パネルのキャプチャボタンを使ってスクリーンショットや画面録画を保存します。保存されたファイルはデスクトップに格納されます。
「Detach simulator(シミュレーターを切断)」をクリックすると、デバイスをシャットダウンせずにストリーミングを停止できます。これにより、パネルの状態は「Attach simulator(シミュレーターを接続)」に戻ります。
デバイス名の下の行では、シミュレーターからの動画ストリームを設定できます。Mac が負荷を感じた場合はフレームレートや解像度を下げるか、エンコーディングを H.264 と JPEG の間で切り替えてください。また、FPSをチェックすると、パネルが受信しているフレームレートを確認できます。これらの設定はパネル上の表示方法を変えるだけで、アプリの実行自体には影響しません。
あなたと Claude は同じデバイスを共有するため、あなたのタップ操作によって Claude が見ているアプリの状態も変化します。特定の画面を Claude に確認させたい場合は、まずタップしてその画面に移動し、その後で指示を出してください。Claude がデバイスを操作中は、画面上部に「Claude is using this device(Claude がこのデバイスを使用しています)」というバッジが表示されます。結果があなたの操作ではなくアプリの状態を正しく反映させるため、バッジが消えるまでタップ操作は控えてください。
How sessions manage devices
各デバイスは、それを起動したセッションに所属するため、並行して実行されるセッション間でデバイスが共有されることはありません。あるセッションのウィンドウに表示されている内容は、そのセッションでの作業の結果であり、他のセッションのものではありません。サイドバーでセッションを切り替えると、会話内容とともにシミュレータの表示も切り替わります。元のセッションに戻ると、デバイスは中断された場所からそのまま再開されます。
Claude が複数のデバイスと連携する場合は、それぞれが独立したウィンドウを開きます。ただし、1 つのセッション内で同時に開けるのは最大 4 つまでです。
Claude Code Desktop は、起動したシミュレータが不要になった時点でシャットダウンします。具体的には、アプリを終了したとき、セッションをアーカイブしたとき、またはデバイスからウィンドウへの接続を解除してから 10 分経過後などです。ユーザー自身がウィンドウ内や Apple の Simulator アプリで起動したデバイスは、自動的にシャットダウンされることはありません。接続中のデバイスをすぐに停止したい場合は、ウィンドウ内のシャットダウンボタンを使用してください。
Claude にデバイスへのアクセス権限を付与する
Claude はデバイスを操作する前にユーザーの同意を求めます。アプリの構築や URL の開封は、セッションの設定に従って許可モードが適用されます。また、ユーザー自身または組織全体で Claude のアクセス権限を完全に無効にすることも可能です。
初回デバイス接続時の許可
Claude がシミュレーターを初めて使用する際、デスクトップアプリからアクセス許可を求めるメッセージが表示されます。この許可は、デバイスの操作権限とスクリーンショットの取得権限を含み、セッションごとではなくデバイスごとに一度だけ付与します。ただし、Claude が取得したスクリーンショットは Anthropic に送信され、通常の会話保持設定に従って保存されるため、Claude が使用するデバイスには実在するアカウントへのログインは避けてください。
一度デバイスの許可を与えると、タップや入力、アプリの起動、スクリーンショットの取得といった Claude の操作は、追加の確認なしに実行されます。これらはユーザーがパネル内で直接クリックして行う場合と同じ信頼性を持ちますが、対象となるのはあくまでシミュレーター内の仮想デバイスだけなので、Mac 版の「コンピューター使用」機能に必要な macOS のアクセシビリティ権限や画面録画権限は不要です。
もし許可を拒否した場合でも、デバイスの起動自体は正常に行われ、ユーザー自身がパネルから操作する分には問題なく動作します。ただし、Claude によるアクセスのみが無効化されます。後で考えが変わった場合は、パネル内の Let Claude use it(Claude に使用させる)ボタンをクリックして許可を変更できます。
許可モードに準拠するアクション
セッションの 許可モード に従うため、一度きりの同意ではなく以下の 2 つのアクションでは追加の確認が必要です:
- デバイス上で URL を開くこと(例:ディープリンクのテストや、デバイスの Safari でのページ読み込み)。URL にはデバイス外へデータを転送するリスクがあるためです。
- アプリのビルドを実行すること。xcodebuild は Mac 上にあるプロジェクトのビルドスクリプトを実行するためです。ただし、すでに進行中のビルド状況を確認するだけの場合は追加の確認は不要です。
シミュレーターアクセスを無効にする
デスクトップアプリの設定から、Claude のシミュレーターアクセス機能をオフにすることができます。組織全体でこの機能を無効化するには、以下の 2 つの方法があります。
- 「disableMobileSimulatorTools」という管理設定を適用すると、Claude のシミュレーターツールがブロックされます。ただし、シミュレーターパネル自体はユーザーの手動操作(タップなど)には引き続き使用可能で、アプリ内からこの設定を上書きすることはできません。
- また、「セッションを隔離された仮想マシン内で実行することを必須とする」ポリシーを設定すると、パネルとツールは完全に無効化されます。
これらのいずれかが適用されている場合、Claude がその旨を通知します。
制限事項
Claude はシミュレーター上のデバイスを操作するのみで、物理的な iPhone や iPad を直接制御することはできません。実際のデバイスでテストを行う場合は、Xcode からアプリを実行し、画面に表示される内容について説明するか、スクリーンショットを会話に添付して Claude に処理させます。
トラブルシューティング
シミュレーターパネルが開かない(Claude がアプリを実行中)
Claude がアプリの実行やテストを意図していることを認識していないか、シミュレーター関連のツールがインストールされていない可能性があります。以下の点を確認してください。
- 目的を明確に伝えてください。例:「iOS Simulator でアプリを実行し、サインアップフローをタップして進めてください」
- シミュレーターアプリを単独で起動し、Xcode と iOS Simulator が正しくインストールされているか確認してください。
- お使いの組織が Claude Code を管理している場合、ポリシーによってシミュレーターツールが無効化されている可能性があります。
- シミュレーターパネルを使用するには、Claude Desktop のバージョンが 1.24012.0 以上である必要があります。「Claude」メニューから「更新を確認」を選択し、アプリを再起動してください。
シミュレーターパネルに「シミュレーターが見つかりませんでした」と表示される
Xcode はインストール済みですが、リスト表示できる iOS シミュレーターがありません。シミュレーター設定画面には、実行すべきセットアップ手順が表示され、各ステップが完了するにつれてチェックマークがついていきます。
不足しているコンポーネントを手動でインストールするには、Xcode の設定から iOS シミュレーターランタイムをダウンロードするか、以下のコマンドを実行してください。
xcodebuild -downloadPlatform iOS
関連記事
- デスクトップでのコンピュータ操作:専用パネルがないアプリの画面制御
- CLI からのコンピュータ操作:CLI が iOS シミュレーターにアクセスする方法
- セッションを並列実行して作業効率化:セッションが変更点をどのように隔離するか
- Claude Code Desktop の始め方
原文を表示
The iOS Simulator pane shows your app running in Apple’s iOS Simulator next to your conversation in Claude Code Desktop. When Claude builds, installs, launches, or checks your app in a simulator, the pane opens automatically and streams the device screen live. Use it to watch Claude run and test your app, or to tap through the app yourself while Claude keeps working.
The simulator pane drives the simulator directly, so it doesn’t need computer use and never takes over your screen or hides your other windows. From the CLI, Claude reaches the iOS Simulator through computer use instead, which controls the simulator on your screen the same way you would with a mouse.
Requirements
The simulator pane uses Apple’s simulator tooling, which the desktop app doesn’t include. Before starting a session, make sure you have:
- Claude Desktop v1.24012.0 or later
- A Mac, since Apple’s iOS Simulator runs only on macOS
- Xcode with the iOS platform installed, which provides the simulator devices. If Xcode lists no simulators yet, see The simulator pane says no simulators were found
The simulator pane is available in local sessions only. In cloud and SSH sessions, Claude runs on a machine that can’t reach the simulators on your Mac.
Run your app in the simulator
You don’t need a command or setting to open the simulator pane. Claude opens it when it runs your app in a simulator.
1
2
3
The simulator pane opens whenever Claude launches the app in a simulator, at any point in the session. When your request is about seeing the app, for example “does the new screen look right?”, Claude starts a simulator before it begins the work. After Claude fixes a bug or changes a screen, ask it to verify the change: relaunching the app reopens the pane if it isn’t open.
The simulator pane shows whichever device the app actually launched in. To test on a specific device, name it in your request, for example “run it on the iPhone SE simulator”, and Claude targets that device when it builds and launches.
A device Claude boots also appears in Apple’s Simulator app, and Claude can install the app on a device you already have booted.
You can also open the simulator pane yourself. Once the session has a simulator attached or has edited Swift files, the Views menu in the session toolbar shows an iOS Simulator entry. If the pane isn’t showing a device yet, click Attach simulator, or pick a specific device from the device menu next to it; picking a shut-down device boots it. If Xcode or its simulators are missing, the pane shows the setup steps instead and checks them off as you complete them.
Control the simulator yourself
The simulator pane is interactive, not only a viewer. While Claude works, or between tasks, you can:
- Tap and swipe by clicking and dragging on the device screen
- Press hardware buttons with the same shortcuts as Apple’s Simulator app: Cmd+Shift+H for Home, Cmd+L to lock, Cmd+Up Arrow and Cmd+Down Arrow for volume
- Rotate the device a quarter turn clockwise with the rotate button or Cmd+Right Arrow
- Switch which device the pane shows from the device menu, which lists each simulator’s OS version and whether it’s booted
- Save a screenshot with Cmd+S or a screen recording with Cmd+R, using the pane’s capture buttons or the shortcuts; the files are saved to your Desktop
- Stop streaming a device without shutting it down by clicking Detach simulator, which returns the pane to its Attach simulator state
The row under the device name tunes the video stream from the simulator. Lower Frame rate or Resolution if the pane strains your Mac, switch Encoding between H.264 and JPEG, or check FPS to display the frame rate the pane is receiving. These settings change how the pane displays the device, not how the app runs.
You and Claude drive the same device, so your taps change the app state Claude sees. To have Claude check a specific screen, navigate to it by tapping, then ask. While Claude is driving the device, the pane shows a Claude is using this device badge above the screen; hold off tapping until the badge clears, so the result reflects the app rather than your input.
How sessions manage devices
Each device belongs to the session that launched it, so parallel sessions don’t share a device: what you see in one session’s pane reflects that session’s work, not another’s. Switching sessions in the sidebar switches the simulator view along with the conversation, and switching back resumes the same device where it left off. If Claude works with more than one device, each opens its own pane, up to 4 per session.
Claude Code Desktop shuts down the simulators it booted once they’re no longer in use: when you quit the app, when you archive the session, or 10 minutes after you detach a device from its pane. Devices you boot yourself, whether from the pane or in Apple’s Simulator app, are never shut down automatically. To shut down the attached device right away, use the shutdown button in the pane.
Grant Claude access to a device
Claude asks for your consent before it controls a device, while building the app or opening a URL on it follows your session’s permission mode. You or your organization can also turn Claude’s access off entirely.
Allow a device the first time
The first time Claude uses a simulator, the desktop app asks you to allow it. The consent covers controlling that device and taking screenshots of it, and you give it once per device rather than once per session. Claude’s screenshots of the device are sent to Anthropic and kept under your normal conversation retention settings, so don’t sign in to real accounts on a device Claude uses.
After you allow a device, Claude’s actions on it, such as tapping, typing, launching the app, and taking screenshots, run without further prompts. They carry the same trust as you clicking in the pane, and they only touch the simulated device, so the pane doesn’t need the macOS Accessibility and Screen Recording permissions that computer use requires.
If you decline, the device still boots and the pane still works for your own taps; only Claude’s access stays off. To change your mind later, click Let Claude use it in the pane.
Actions that follow your permission mode
Two actions follow your session’s permission mode instead of the one-time consent:
- Opening a URL on the device, for example to test a deep link or load a page in the device’s Safari, because a URL can carry data off the device.
- Building the app, because xcodebuild runs your project’s build scripts on your Mac. Checking on a build already in progress doesn’t prompt.
Turn off simulator access
You can turn Claude’s simulator access off in the desktop app’s settings. Organizations have two ways to turn it off for everyone:
- The disableMobileSimulatorTools managed setting blocks Claude’s simulator tools. The simulator pane stays usable for your own taps, and the setting can’t be overridden from within the app.
- A policy that requires sessions to run inside an isolated virtual machine disables the pane and the tools entirely.
Claude tells you when either applies.
Limitations
Claude drives simulated devices only and can’t control a physical iPhone or iPad. To test on one, run the app on it from Xcode yourself, then describe what you see or attach a screenshot to the conversation for Claude to work from.
Troubleshooting
The simulator pane doesn’t open when Claude runs the app
Claude may not have recognized that you wanted to run or test the app, or the simulator tooling may be missing. Check the following:
- State the goal explicitly, for example “run the app in the iOS Simulator and tap through the signup flow”.
- Confirm Xcode and the iOS Simulator are installed by launching the Simulator app on its own.
- If your organization manages Claude Code, the simulator tools may be disabled by policy.
- The simulator pane requires Claude Desktop v1.24012.0 or later. Open Claude → Check for Updates, then restart the app.
The simulator pane says no simulators were found
Xcode is installed but has no iOS simulators to list. The simulator pane shows the setup steps to follow and checks them off as each one completes. To install the missing piece manually, download the iOS simulator runtime from Xcode’s settings, or run xcodebuild -downloadPlatform iOS.
See also
- Computer use in Desktop: screen control for apps without a dedicated pane
- Computer use from the CLI: how the CLI reaches the iOS Simulator
- Work in parallel with sessions: how sessions isolate changes
- Get started with Claude Code Desktop
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み