1.下载reveal(http://download.csdn.net/download/sinat_28585351/9945878这里提供了破解版)。
2.打开终端
在终端输入$vim ~/.lldbinit
创建一个名为.lldbinit的文件,然后进入编辑状态将下面内容输入文件中
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
这里是在给lldb设置4个别名,意思是:
1)reveal_load_sim 模拟器加载reveal调试用的动态链接库。
2)reveal_load_dev 真机加载reveal调试用的动态链接库。
3)reveal_start 启动reveal调试功能。
4)reveal_stop 结束reveal调试功能。
3.在AppDelegate类的application:(UIApplication *)application didFinishLaunchingWithOptions:方法中打个断点
1) 添加断点,在断点上右击,选择”Edit BreakPoint”.
2) 单击”Action”右边的”Add Action”,然后输入”reveal_load_sim”.
3) 勾选上”Options”上的“Automatically continue after evaluating actions”选项。
然后就可以运行我们运行模拟器了,打开reveal,就可以在reveal界面左上角看到有模拟器可以选择调试,选择它,则可以在reveal中查看调试ios程序的界面了。
关于真机调试
要越狱手机.但是网上也看些教程,如下方法没有尝试过,有兴趣的可以试试,欢迎留言
1)在reveal菜单栏的”Help”->”Show Reveal library in Finder”选项,将libReveal.dylib拖到工程里,Xcode默认将libReveal.dylib设置到”Link Binary With Libraries”,需要我们进行调整,将”Link Binary With Libraries”中的libReveal.dylib删除,再将其添加到”Copy Bundle Resources”下面,然后用Reveal连接真机的方式就和连接模拟器的方式是一样得了.这里需要注意的就是我们要把上面断点处的Action输入的内容从reveal_load_sim改成reveal_load_dev