I'm trying to debug an iOS app and I'm having problems with lldb in the simulator. Calling class methods doesn't seem to work. Instance methods work fine.
(lldb) po Category
<no result>
(lldb) po [Category class]
error: Couldn't prepare the expression for execution in the target
(lldb) po self
(TagsTableViewController *) $5 = 0x085585a0 <TagsTableViewController: 0x85585a0>
I've tried the 4.3 and 5.1 simulators but both exhibit the same issues.
Everything works fine when debugging on a device.
In lldb you can set breakpoints by typing either break or b followed by information on where you want the program to pause. After the b command, you can put either: a function name (e.g., b my_subroutine ) a line number (e.g., b 12 )
Loading a Program into lldb First we need to set the program to debug. As with gdb, you can start lldb and specify the file you wish to debug on the command line: $ lldb /Projects/Sketch/build/Debug/Sketch. app Current executable set to '/Projects/Sketch/build/Debug/Sketch.
Simulator app, available within Xcode, presents the iPhone, iPad, or Apple Watch user interface in a window on your Mac computer. You interact with Simulator by using the keyboard and the mouse to emulate taps, device rotation, and other user actions.
This works. Thanks to @devioustree who answered in a comment above.
Basic command is structured like this:
po [(Class)objc_getClass("ClassName") class]
To invoke someClassMethodHere
:
po [[(Class)objc_getClass("ClassName") class] someClassMethodHere]
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