Detect If Your Application Is Running In The Debugger

The C function below returns true or false depending on whether or not the application making the call is running in the Xcode debugger. Honestly, I’ve not come up with a scenario when I’ll need this, however, anything that makes system level calls is an interesting study in how things in iOS.

Notice the code below is a C function, not an Objective-C method:

You can call the above code as follows:

This code example is courtesy Apple from their Technical Q&A section.

  1. Isn’t that first step to fight piracy in your app? :)

Comments are closed.