Skip to content
PidebugMobile1 file · +76 −60

Fix iOS simulator watchdog crash in iCloud backup transport (Kotlin Multiplatform)

Session from pi-coding-sessions on Hugging Face by championswimmer · MIT · condensed by Coders Talk

5msession
0interventions
GOAL

Diagnose and fix an EXC_CRASH/8BADF00D watchdog crash occurring when running the app with iCloud enabled on the simulator, then verify by running the built app on the running simulator.

  1. Prompt · +0
    Solve the crash that happens when running the app with iCloud enabled on simulator; feel free to search the internet to debug.
  2. Agent did · +0m
    Read module docs, searched codebase for ICloudBackupTransport, isAvailable, and BackupTransportRegistry, and inspected SettingsScreen to trace where the crash originates.
  3. Agent did · +0m
    Searched the web for guidance on iOS ubiquity container/file existence checks blocking the main thread and causing 8BADF00D watchdog terminations, confirming the suspected root cause.
  4. Agent did · +1m
    Tagged context checkpoints, then edited ICloudBackupTransport.kt to move file system operations (fileExists, ensureBackupDirectoryExists) off the main thread using Dispatchers.IO via a new runFileSystemTask helper.
  5. Agent did · +1m
    Ran the Gradle iOS simulator framework link build to verify the fix compiles, checked git diff to confirm only the intended file changed, and summarized the root cause and fix.
  6. Prompt · +2m
    Run it on the simulator for iPhone (that is already running).
  7. Fail · +2m
    Multiple xcodebuild invocations failed with scheme/target/destination errors while trying to build and target the already-booted iPhone simulator.
  8. Agent did · +3m
    Located the built TwoFac.app in DerivedData, installed and launched it via simctl on the booted iPhone 16 w Watch simulator, then verified the process was running via launchctl print.
  9. Outcome · +5m
    Fix implemented in ICloudBackupTransport.kt (moved file I/O off main thread); app installed and launched on booted iPhone 16 w Watch simulator (PID 76282), running state confirmed via launchctl.
VERDICT

Next time I'd point straight at the ICloudBackupTransport file since the crash log made the source pretty obvious, and let the agent confirm the main-thread-blocking theory with a quick web search before touching code. The web search confirming that NSFileManager and ubiquity container calls block the main thread is what actually justified the fix — everything else was just locating the file and later fumbling through xcodebuild flags to get it running on the simulator.

I tried this · 0

Discussion · 0

How Builds work