Chicowitz Chicowitz - 1 month ago 9
iOS Question

iOS: How to debug "freshly launching" an app from a URL

When launching an app from a URL, there is a distinction between whether the URL is freshly launching an app, or if it's resuming an app that has been put into a suspended state.

My question is, how do I debug the process of a "fresh launch" from a URL? Hitting "Run" in Xcode automatically opens the app. Then, I have to suspend the app to reach Safari and access my test site. But if I close my suspended app, Xcode is no longer attached to it and I'm unable to debug.

Answer

These steps can be followed. Founded at this link.

  1. Run the app from Xcode to install it on your device and then stop it from Xcode.
  2. Force quit the app from the app switcher UI on the device.
  3. Navigate to the scheme for the project in Xcode. Under the Run section's Info tab, there is a radio button for "Wait for executable to be launched". Make sure this is checked instead of the "Automatically" option.
  4. Run the app from Xcode. It will not open on the device, but the debugger will wait for it to open and then it will attach to it.