AGENT SKILL

mobiai-ios-device

Use when interacting with an iOS Simulator — run simctl commands, capture screenshots, read device logs, manage simulators.

License 许可
MIT
最近更新
2026-11-13
Stars
★ 492
Forks
14

01 前言 Front Matter

name
mobiai-ios-device
license
MIT
platforms
[ "ios" ]
description
Use when interacting with an iOS Simulator — run simctl commands, capture screenshots, read device logs, manage simulators.
compatibility
[ "claude-code", "cursor", "copilot", "codex" ]

03 SKILL.md 正文

iOS Device Interaction

Community contribution welcome! This skill is a skeleton. If you have iOS development experience, please help flesh it out with battle-tested commands and workflows.

Interact with iOS Simulators using xcrun simctl and related tools.

When to Use

  • Reproducing a bug on an iOS Simulator
  • Taking screenshots or capturing logs
  • Managing Simulators

Simulator Management

List Available Simulators

xcrun simctl list devices available

Boot a Simulator

# Boot by name
xcrun simctl boot "iPhone 15 Pro"

# Boot by UDID
xcrun simctl boot <UDID>

# Open Simulator.app (if you need the GUI)
open -a Simulator

Shut Down

xcrun simctl shutdown <UDID>
xcrun simctl shutdown all  # Shut down all simulators

Erase (reset to clean state)

xcrun simctl erase <UDID>

App Management

Install

xcrun simctl install booted /path/to/MyApp.app

Launch

xcrun simctl launch booted com.example.myapp

Terminate

xcrun simctl terminate booted com.example.myapp

Uninstall

xcrun simctl uninstall booted com.example.myapp

UI Inspection

Accessibility Snapshot

# Get accessibility hierarchy (equivalent to Android's UIAutomator dump)
xcrun simctl spawn booted accessibility_inspector  # Limited CLI support

# Alternative: Use Xcode's Accessibility Inspector GUI
# Or use XCUITest for programmatic UI inspection

Note: iOS doesn't have a direct CLI equivalent to Android's uiautomator dump. For automated UI interaction, consider using:

  • XCUITest for reliable UI automation
  • Accessibility Inspector (GUI) for manual inspection
  • xcrun simctl io booted screenshot combined with vision analysis

Screenshots

xcrun simctl io booted screenshot screenshot.png

Screen Recording

# Start recording
xcrun simctl io booted recordVideo recording.mp4

# Stop with Ctrl+C

Logs

View App Logs

# Stream logs
xcrun simctl spawn booted log stream --predicate 'process == "MyApp"' --level debug

# Show recent logs
xcrun simctl spawn booted log show --predicate 'process == "MyApp"' --last 5m

# Check for crashes
xcrun simctl spawn booted log show --predicate 'eventMessage contains "crash"' --last 10m

Crash Reports

# Crash reports are saved to:
ls ~/Library/Logs/DiagnosticReports/ | grep MyApp

UI Interaction

Simulated Input

# Open a URL (deep link)
xcrun simctl openurl booted "myapp://screen/settings"

# Send a push notification
xcrun simctl push booted com.example.myapp notification.json

# Set device location
xcrun simctl location booted set 40.7128,-74.0060

# Add photos to simulator
xcrun simctl addmedia booted photo.jpg

Keyboard Input

# Type text via pasteboard
xcrun simctl pbcopy booted <<< "Hello World"
# Then paste in the simulator

Privacy & Permissions

# Grant permissions
xcrun simctl privacy booted grant photos com.example.myapp
xcrun simctl privacy booted grant camera com.example.myapp
xcrun simctl privacy booted grant location-always com.example.myapp

# Revoke permissions
xcrun simctl privacy booted revoke all com.example.myapp

# Reset all privacy settings
xcrun simctl privacy booted reset all com.example.myapp

Status Bar Override

# Set clean status bar for screenshots
xcrun simctl status_bar booted override \
  --time "9:41" \
  --batteryState charged \
  --batteryLevel 100 \
  --wifiBars 3 \
  --cellularBars 4

Common Issues

Simulator won't boot

xcrun simctl shutdown all
xcrun simctl erase all
# Or delete derived data: rm -rf ~/Library/Developer/Xcode/DerivedData

App crashes on launch

Check crash logs and Console.app for details.


Want to improve this skill? This is a community skeleton. Add your battle-tested workflows, common pitfalls, and advanced simctl techniques via a PR to MobiAI-Core.

04 同仓库更多 Skills