I am trying to debug an iOS app in Xcode. My scheme is with the Build Configuration in Debug. When I run the application, the Debug panel opens but when the application opens in the simulator or on the device, the panel closes and does not allow me to debug.
What are the conditions that must be met in order to debug an application in Xcode?
My Xcode version is 11.3.1. My macOS version is 10.15.2.
Update 1
I put image of my configurations:

When I try to attach the debug to simulator by "Attach to Process by PID or Name..." I have the following error:


The scheme you are running must be enabled for Debugging. This is the default but it might have been changed, by accident, or during experimentation.
Here is a correct example, enabling debug.

Ensure you have set some breakpoints.
Furthermore, it might be that your preference settings are incorrect for debugging.
The following settings need to be checked in Xcode > Preferences; Behaviour Tab.
Note two checked items for the Running Pauses left panel selection:
![Behaviour Preferences[1]](https://i.sstatic.net/kRgrK.png)
Note that when Xcode is installed, upon first use it will prompt for Developer Access to your system requiring a password for the Administrator privileged account (normally your own account has such privilege).
In order for debug attach to work, Developer Mode must be enabled. This can be checked:
# DevToolsSecurity -verbose -status
Getting rights definition for: system.privilege.taskport.debug
Current rights definition dictionary:
"k-of-n" : 1
"class" : "rule"
"created" : 582290628
"version" : 0
"modified" : 589046609
"comment" : "For use by Apple. WARNING: administrators are advised
not to modify this right."
"rule" : { "is-admin", "is-developer", "authenticate-developer" }
Developer mode is currently enabled.
To enable developer mode if it is not enabled, use
# sudo DevToolsSecurity -enable
Put breakpoints to your code whatever you want to debug by clicking the number of line.

Hope it helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With