How to call class methods in the iOS simulator with lldb?

折月煮酒 提交于 2019-12-03 06:08:19

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]

Adding this to expand on the accepted answer...

If you're trying to assign a new value to a variable in lldb like I was instead of just printing out the value then do something like this...

expr self.myArray = (NSArray*)[[(Class)objc_getClass("NSArray") class] arrayWithObjects:@"valueOne",@"valueTwo",@"etc",nil]
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!