Cannot debug widget in a watch target using Xcode 14.1

Cannot debug widget in a watch target using Xcode 14.1 on Apple Watch simulator or real Apple Watch device.

Debug> Attach to Process does not work for me.

Xcode 14.1 known issue:

Xcode 14.1 release notes seems to mention a known issue

After Running a widget extension, users will need to manually start the debugging session with Debug -> Attach to Process. (99285608)

Approach (works on simulator and device)

  • Run app target and widget target at the same time
  • Attach debugger to your widget

Steps

  1. Select app scheme and run on iOS device (don't stop)
  2. Select widget scheme and run on iOS (don't stop)
    • So both the targets are running at the same time
  3. Select widget scheme then Debug > Attach to Process > Select your widget target name
  4. On device / simulator add widget

Note:

  • You need to attach the debugger every time you run (Xcode forgets debugger added for the previous run)

Now your breakpoints should work as expected and you can debug

Cannot debug widget in a watch target using Xcode 14.1
 
 
Q