debug
Debug - iOS App Debugging Loop
Use XcodeBuildMCP and ios-simulator MCPs to diagnose issues, capture app state, and collaborate with users on fixes. Always confirm before making changes.
Workflow
-
Capture current state — Use ios-simulator to capture screenshots and understand the current visual state of the app. Use XcodeBuildMCP to read build logs and runtime errors.
-
Gather diagnostic information — Collect relevant information:
- Screenshot of the issue using ios-simulator
- Console logs and error messages from XcodeBuildMCP
- App state and behavior observations
- Ask: "Looking at this screenshot and these logs, can you describe exactly what's wrong or what you expected to happen?"
-
Analyze the problem — Review the captured information:
- Identify error patterns in logs
- Compare visual output to expected behavior
- Locate relevant code sections that might be causing the issue
-
Propose changes clearly — Describe intended fixes with specifics:
- Bad: "I'll fix the layout"
- Good: "I'll update the VStack spacing from 8 to 16 points and add .padding(.horizontal, 20) to fix the alignment issue shown in the screenshot"
-
Confirm before implementing — Use AskUserQuestion to get explicit approval. Never modify code without confirmation.
-
Verify with comparison — After changes:
- Rebuild the app using XcodeBuildMCP
- Capture a new screenshot to confirm the fix
- Check logs to ensure errors are resolved
- Ask: "Does this match what you were looking for?"
XcodeBuildMCP Tools
Use these XcodeBuildMCP tools for building and analyzing:
build— Build the Xcode project/workspaceget-build-logs— Retrieve build logs to diagnose compilation errorsget-runtime-logs— Get runtime logs from the running appclean— Clean build artifacts before rebuildingtest— Run unit tests to verify fixes
ios-simulator Tools
Use these ios-simulator tools for app interaction and state capture:
launch-app— Launch the app in the simulatortake-screenshot— Capture the current simulator screentap— Tap at specific coordinates on the screenswipe— Perform swipe gesturesenter-text— Type text into focused text fieldsget-device-info— Get simulator device informationinstall-app— Install the app on the simulatoruninstall-app— Uninstall the app from the simulator
Related Skills
When implementing fixes, load these skills for guidance:
app:swiftui-architecture— SwiftUI patterns, state management, and architectural guidanceapp:swift-testing— Testing patterns and best practices
Debugging Workflow Example
- User reports: "The login button doesn't work"
- Capture screenshot showing the button
- Check runtime logs for tap events or errors
- Identify the issue in code (e.g., missing action binding)
- Propose fix: "I'll connect the button's action to the LoginIntent as defined in app-intent-driven-development"
- Get confirmation
- Implement fix
- Rebuild app
- Take new screenshot showing working button
- Verify logs show successful tap handling
Before/After Verification
After implementing changes:
- Rebuild the app with XcodeBuildMCP
- Launch the updated app in the simulator
- Take a new screenshot of the same view
- Compare build/runtime logs (before and after)
- Present screenshots side by side
- Ask: "Does this resolve the issue?"
- If not, repeat the feedback loop