- Compile UIUtilities.m into a dylib or bundle. You can download it precompiled here.
- Upload the file to the device, e.g. /var/mobile/UIUtilities.bundle. Do not put it in /var/root/.
- Now attach gdb to the executable you want to investigate.
- Inject UIUtilities to the executable. In the gdb prompt, type:
call (int)dlopen("/var/mobile/UIUtilities.bundle", 10)If a nonzero value appears, injection succeeded.
- Finally, type:
call (void)UILogViewHierarchy((int)[[UIApplication sharedApplication] keyWindow])The UIView hierarchy of the key window will be recorded in syslog.
Thursday, June 4, 2009
Displaying UIView hierarchy of a compiled app
Suppose you want to investigate the view hierarchy of some app you did not write. There is a simple way using GDB: