如何使用lldb在iOS模拟器中调用类方法? [英] How to call class methods in the iOS simulator with lldb?

查看:136
本文介绍了如何使用lldb在iOS模拟器中调用类方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试iOS应用程序,并且我在模拟器中遇到了lldb问题。调用类方法似乎不起作用实例方法工作正常。

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>

我已经尝试了4.3和5.1模拟器,但都表现出相同的问题。

I've tried the 4.3 and 5.1 simulators but both exhibit the same issues.

在设备上进行调试时,一切正常。

Everything works fine when debugging on a device.

推荐答案

感谢@devioustree,他在上面的评论中回答。

This works. Thanks to @devioustree who answered in a comment above.

基本命令的结构如下:

po [(Class)objc_getClass("ClassName") class]

调用 someClassMethodHere $ b

po [[(Class)objc_getClass("ClassName") class] someClassMethodHere]

这篇关于如何使用lldb在iOS模拟器中调用类方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆