Turning off WiFi on iPhone breaks connection to Xcode debugger

I have a bug in my app that happens when the app is "offline" without and internet connection. The app should still work as it stores content locally. However I am struggling to debug the issue because turning off WiFi breaks the connection to the Xcode debugger, even though it is plugged in via USB.

Did I turn on some setting to debug over WiFi? How do I debug over USB so I can see the log output without a network connection to the iPhone?

Answered by DTS Engineer in 803926022

In general, Xcode should be able to debug over USB just fine. Consider this sequence:

  1. I connected my iOS device via USB. It’s running iOS 17.6.1 and supports both Wi-Fi and WWAN.

  2. On the device, I used Settings > Wi-Fi to turn Wi-Fi off completely [1].

  3. Using Xcode 16.0 on macOS 14.6.1, I created a new test app from the iOS > App template.

  4. I lowered the deployment target to iOS 17, because the default project targets iOS 18.

  5. I built and ran the app on the device. That worked as expected.

  6. I choose Debug > Pause, and verified that the debugger is working.

  7. I stopped the app.

  8. Back on the device, in Settings, I turned on Airplane Mode. This disables WWAN as well.

  9. Back in Xcode, I repeated steps 5 and 6. Debugging continues to work.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Turning Wi-Fi off in Settings actually turns it off; turning it off in Control Center just leaves the current network for the rest of the day.

In general, Xcode should be able to debug over USB just fine. Consider this sequence:

  1. I connected my iOS device via USB. It’s running iOS 17.6.1 and supports both Wi-Fi and WWAN.

  2. On the device, I used Settings > Wi-Fi to turn Wi-Fi off completely [1].

  3. Using Xcode 16.0 on macOS 14.6.1, I created a new test app from the iOS > App template.

  4. I lowered the deployment target to iOS 17, because the default project targets iOS 18.

  5. I built and ran the app on the device. That worked as expected.

  6. I choose Debug > Pause, and verified that the debugger is working.

  7. I stopped the app.

  8. Back on the device, in Settings, I turned on Airplane Mode. This disables WWAN as well.

  9. Back in Xcode, I repeated steps 5 and 6. Debugging continues to work.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Turning Wi-Fi off in Settings actually turns it off; turning it off in Control Center just leaves the current network for the rest of the day.

Just so you know, while writing the above I saw some very weird behaviour. I’m still digging into that, but I posted the above so we can establish a baseline of things that we agree do actually work. Once we have a stable base, we can then start exploring the stuff that doesn’t work O-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Turning off WiFi on iPhone breaks connection to Xcode debugger
 
 
Q