ios-debugger-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

iOS Debugger Agent

iOS Debugger Agent

Overview

概述

Use XcodeBuildMCP to build and run the current project scheme on a booted iOS simulator, interact with the UI, and capture logs. Prefer the MCP tools for simulator control, logs, and view inspection.
使用XcodeBuildMCP在已启动的iOS模拟器上构建并运行当前项目scheme,与UI交互并捕获日志。优先使用MCP工具进行模拟器控制、日志查看和视图检查。

Core Workflow

核心工作流程

Follow this sequence unless the user asks for a narrower action.
除非用户要求更具体的操作,否则请遵循以下步骤。

1) Discover the booted simulator

1) 发现已启动的模拟器

  • Call
    mcp__XcodeBuildMCP__list_sims
    and select the simulator with state
    Booted
    .
  • If none are booted, ask the user to boot one (do not boot automatically unless asked).
  • 调用
    mcp__XcodeBuildMCP__list_sims
    并选择状态为
    Booted
    的模拟器。
  • 如果没有已启动的模拟器,请要求用户启动一个(除非用户要求,否则不要自动启动)。

2) Set session defaults

2) 设置会话默认值

  • Call
    mcp__XcodeBuildMCP__session-set-defaults
    with:
    • projectPath
      or
      workspacePath
      (whichever the repo uses)
    • scheme
      for the current app
    • simulatorId
      from the booted device
    • Optional:
      configuration: "Debug"
      ,
      useLatestOS: true
  • 调用
    mcp__XcodeBuildMCP__session-set-defaults
    ,参数包括:
    • projectPath
      workspacePath
      (根据仓库使用的类型选择)
    • 当前应用的
      scheme
    • 已启动设备的
      simulatorId
    • 可选参数:
      configuration: "Debug"
      useLatestOS: true

3) Build + run (when requested)

3) 构建 + 运行(当用户要求时)

  • Call
    mcp__XcodeBuildMCP__build_run_sim
    .
  • If the app is already built and only launch is requested, use
    mcp__XcodeBuildMCP__launch_app_sim
    .
  • If bundle id is unknown:
    1. mcp__XcodeBuildMCP__get_sim_app_path
    2. mcp__XcodeBuildMCP__get_app_bundle_id
  • 调用
    mcp__XcodeBuildMCP__build_run_sim
  • 如果应用已构建完成且仅需启动,请使用
    mcp__XcodeBuildMCP__launch_app_sim
  • 如果bundle id未知:
    1. mcp__XcodeBuildMCP__get_sim_app_path
    2. mcp__XcodeBuildMCP__get_app_bundle_id

UI Interaction & Debugging

UI交互与调试

Use these when asked to inspect or interact with the running app.
  • Describe UI:
    mcp__XcodeBuildMCP__describe_ui
    before tapping or swiping.
  • Tap:
    mcp__XcodeBuildMCP__tap
    (prefer
    id
    or
    label
    ; use coordinates only if needed).
  • Type:
    mcp__XcodeBuildMCP__type_text
    after focusing a field.
  • Gestures:
    mcp__XcodeBuildMCP__gesture
    for common scrolls and edge swipes.
  • Screenshot:
    mcp__XcodeBuildMCP__screenshot
    for visual confirmation.
当需要检查或与运行中的应用交互时使用以下工具。
  • 描述UI:在点击或滑动前调用
    mcp__XcodeBuildMCP__describe_ui
  • 点击:调用
    mcp__XcodeBuildMCP__tap
    (优先使用
    id
    label
    ;仅在必要时使用坐标)。
  • 输入文本:聚焦输入框后调用
    mcp__XcodeBuildMCP__type_text
  • 手势操作:调用
    mcp__XcodeBuildMCP__gesture
    执行常见的滚动和边缘滑动操作。
  • 截图:调用
    mcp__XcodeBuildMCP__screenshot
    进行视觉确认。

Logs & Console Output

日志与控制台输出

  • Start logs:
    mcp__XcodeBuildMCP__start_sim_log_cap
    with the app bundle id.
  • Stop logs:
    mcp__XcodeBuildMCP__stop_sim_log_cap
    and summarize important lines.
  • For console output, set
    captureConsole: true
    and relaunch if required.
  • 启动日志捕获:使用应用的bundle id调用
    mcp__XcodeBuildMCP__start_sim_log_cap
  • 停止日志捕获:调用
    mcp__XcodeBuildMCP__stop_sim_log_cap
    并总结重要日志行。
  • 如需捕获控制台输出,请设置
    captureConsole: true
    ,必要时重新启动应用。

Troubleshooting

故障排除

  • If build fails, ask whether to retry with
    preferXcodebuild: true
    .
  • If the wrong app launches, confirm the scheme and bundle id.
  • If UI elements are not hittable, re-run
    describe_ui
    after layout changes.
  • 如果构建失败,询问用户是否要使用
    preferXcodebuild: true
    参数重试。
  • 如果启动了错误的应用,请确认scheme和bundle id。
  • 如果UI元素无法点击,请在布局变化后重新调用
    describe_ui