Using private (undocumented) iOS methods for debugging

Using private iOS methods is strictly forbidden by Apple… but only in Release builds. There are plenty of useful iOS methods that can be utilised for debugging purposes – just make sure to remove them from the Release build  🙂


Sometimes it’s useful to see the view hierarchy to find layout problems or to just explore the framework.

For a simple view with a slider and a button like this:


recursiveDescription will provide the list of its subviews with their properties:


Ambiguous layouts are extremely hard to debug. To resolve ambiguous layouts, the first thing to try, is to stop on exception and type po [[UIWindow keyWindow] _autolayoutTrace]; to console. This will provide precious information about ambiguous layouts:


This private method lists all instance variables of the object together with their values.

For example, let’s call ivarDescription on UIWindow:

And the result:

Note that it also lists the class, where the variable is defined.


This method will list all methods of the object including class methods and properties

And the result: