iOS Simulator
Use Simulator as a reproducible verification environment while keeping device selection and destructive operations explicit.
Contents
Scope and Safety
This skill owns Simulator discovery, boot/shutdown, app install/launch, screenshots, logs, permissions, locations, push simulation, containers, and CI lifecycle. It does not replace real-device verification for hardware, performance, networking conditions, push delivery, camera, Bluetooth, NFC, or other device-only behavior.
Resolve an explicit simulator UDID before mutating state. Prefer an already booted suitable device. Do not erase or delete all simulators, broad CoreSimulator directories, or unrelated devices as a routine recovery step. If an erase/delete is genuinely needed, verify the exact target and preserve user data unless the task authorizes its removal.
Read simctl Command Reference for command syntax and less common operations.
Workflow
- Inspect the Xcode project/workspace, scheme, supported platform, deployment target, installed runtimes, and available devices.
- Select one destination by UDID and boot it if needed.
- Build the intended scheme for that destination with a dedicated derived-data path when isolation helps.
- Install and launch by bundle identifier; preserve the installed app container unless a clean-state test is required.
- Capture logs, screenshots, and interaction evidence relevant to the request.
- Clean up only devices, overrides, permissions, locations, or temporary artifacts created for the task.
Core Commands
xcrun simctl list devices available
xcrun simctl bootstatus <UDID> -b
xcodebuild -project App.xcodeproj -scheme App \
-destination 'platform=iOS Simulator,id=<UDID>' build
xcrun simctl install <UDID> /path/to/App.app
xcrun simctl launch <UDID> com.example.app
xcrun simctl io <UDID> screenshot /tmp/app.png
Use parsed command output or an explicit known UDID. Do not hardcode a device name when multiple runtimes can contain the same name.
State and Diagnostics
- Reinstalling over an app normally preserves its data; uninstalling or erasing does not.
- Use
get_app_container before inspecting sandboxed files.
- Prefer subsystem/category log predicates over unfiltered log streams.
- Clear status-bar, location, appearance, and permission overrides after tests that change them.
- Push simulation validates payload handling in Simulator, not production APNs delivery.
- Permission grants are useful in CI; permission behavior itself needs dedicated denied/limited/authorized tests.
Recovery
When launch or boot fails, inspect device state and the exact error first. Try the narrowest recovery: terminate the app, relaunch, shut down the chosen simulator, or recreate only the disposable device created for the task. Treat erase/delete as destructive and target a validated UDID.
Do not present broad cache deletion or erase all as a default fix. Stop and report when recovery would remove user-owned simulator data outside the requested scope.
Verification Matrix
Choose checks proportional to the change:
- build success and clean diagnostics
- cold/warm launch
- persistence across relaunch
- target appearance and Dynamic Type size
- required permission states
- screenshots of important states
- focused logs for crashes or runtime warnings
- real-device follow-up for unsupported hardware behavior
Common Mistakes
- Hardcoding device names instead of targeting explicit simulator UDIDs.
- Assuming APNs remote push behavior in Simulator is identical to production hardware.
- Executing
erase all or deleting CoreSimulator folders as a default troubleshooting step.
- Leaving override states (status bar, location, appearance) active after test execution.
- Testing Bluetooth Low Energy or camera capture on Simulator without mocked data or fallback.
Review Checklist
References
- Complete simctl command reference
1---2name: ios-simulator3description: Build, install, launch, inspect, and test iOS apps with Simulator and simctl. Use for simulator lifecycle, screenshots, logs, permissions, locations, push payloads, app containers, and repeatable local or CI verification.4---56# iOS Simulator78Use Simulator as a reproducible verification environment while keeping device selection and destructive operations explicit.910## Contents1112- [Scope and Safety](#scope-and-safety)13- [Workflow](#workflow)14- [Core Commands](#core-commands)15- [State and Diagnostics](#state-and-diagnostics)16- [Recovery](#recovery)17- [Verification Matrix](#verification-matrix)18- [Common Mistakes](#common-mistakes)19- [Review Checklist](#review-checklist)20- [References](#references)2122## Scope and Safety2324This skill owns Simulator discovery, boot/shutdown, app install/launch, screenshots, logs, permissions, locations, push simulation, containers, and CI lifecycle. It does not replace real-device verification for hardware, performance, networking conditions, push delivery, camera, Bluetooth, NFC, or other device-only behavior.2526Resolve an explicit simulator UDID before mutating state. Prefer an already booted suitable device. Do not erase or delete all simulators, broad CoreSimulator directories, or unrelated devices as a routine recovery step. If an erase/delete is genuinely needed, verify the exact target and preserve user data unless the task authorizes its removal.2728Read [simctl Command Reference](references/simctl-commands.md) for command syntax and less common operations.2930## Workflow31321. Inspect the Xcode project/workspace, scheme, supported platform, deployment target, installed runtimes, and available devices.332. Select one destination by UDID and boot it if needed.343. Build the intended scheme for that destination with a dedicated derived-data path when isolation helps.354. Install and launch by bundle identifier; preserve the installed app container unless a clean-state test is required.365. Capture logs, screenshots, and interaction evidence relevant to the request.376. Clean up only devices, overrides, permissions, locations, or temporary artifacts created for the task.3839## Core Commands4041```bash42xcrun simctl list devices available43xcrun simctl bootstatus <UDID> -b44xcodebuild -project App.xcodeproj -scheme App \45 -destination 'platform=iOS Simulator,id=<UDID>' build46xcrun simctl install <UDID> /path/to/App.app47xcrun simctl launch <UDID> com.example.app48xcrun simctl io <UDID> screenshot /tmp/app.png49```5051Use parsed command output or an explicit known UDID. Do not hardcode a device name when multiple runtimes can contain the same name.5253## State and Diagnostics5455- Reinstalling over an app normally preserves its data; uninstalling or erasing does not.56- Use `get_app_container` before inspecting sandboxed files.57- Prefer subsystem/category log predicates over unfiltered log streams.58- Clear status-bar, location, appearance, and permission overrides after tests that change them.59- Push simulation validates payload handling in Simulator, not production APNs delivery.60- Permission grants are useful in CI; permission behavior itself needs dedicated denied/limited/authorized tests.6162## Recovery6364When launch or boot fails, inspect device state and the exact error first. Try the narrowest recovery: terminate the app, relaunch, shut down the chosen simulator, or recreate only the disposable device created for the task. Treat erase/delete as destructive and target a validated UDID.6566Do not present broad cache deletion or `erase all` as a default fix. Stop and report when recovery would remove user-owned simulator data outside the requested scope.6768## Verification Matrix6970Choose checks proportional to the change:7172- build success and clean diagnostics73- cold/warm launch74- persistence across relaunch75- target appearance and Dynamic Type size76- required permission states77- screenshots of important states78- focused logs for crashes or runtime warnings79- real-device follow-up for unsupported hardware behavior8081## Common Mistakes8283- Hardcoding device names instead of targeting explicit simulator UDIDs.84- Assuming APNs remote push behavior in Simulator is identical to production hardware.85- Executing `erase all` or deleting CoreSimulator folders as a default troubleshooting step.86- Leaving override states (status bar, location, appearance) active after test execution.87- Testing Bluetooth Low Energy or camera capture on Simulator without mocked data or fallback.8889## Review Checklist9091- [ ] Project, scheme, runtime, target, and bundle identifier are resolved92- [ ] Commands target an explicit UDID93- [ ] Existing app data is preserved unless clean state is required94- [ ] Screenshots and logs correspond to the tested build95- [ ] Overrides and task-created devices are cleaned up narrowly96- [ ] No broad erase/delete operation targets unrelated simulator data97- [ ] Simulator-only results are not claimed as real-device proof98- [ ] CI-created devices have deterministic teardown99100## References101102- [Complete simctl command reference](references/simctl-commands.md)