界面调试工具Reveal的使用介绍

Reveal

 

注: 此处介绍Reveal,其中大部分内容来自于唐巧的《iOS开发进阶》一书,以此说明。

 

如何使用Reveal进行模拟器调试,只需进行以下三个步骤即可。


1. 创建.lldbinit文件

 


  1. vim ~/.lldbinit  



2. 输入以下内容,创建别名

  1. command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);  
  2.   
  3. command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);  
  4.   
  5. command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];  
  6.   
  7. command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object: nil nil];  

 

 


其中各个别名的含义:

 

  •  `reveal_load_sim` 为模拟器加载reveal调试用的动态链接库
  •  `reveal_load_dev` 为真机加载
  •  `reveal_start` 启动reveal调试功能
  • *`reveal_stop` 结束reveal调试功能



3. 增加断点

定位到AppDelegate类中的`application:didFinishLaunchingWithOptions:`方法,进行以下三个步骤:

  1. 增加一个断点,右键单击断点,选择`Edit Breakpoint`
  2. 单击`Action`,然后输入`reveal_load_sim`
  3. 勾选上`Options`上的 `Automatically continue after evaluating`

 

 

posted @ 2016-05-06 15:08  洁0  阅读(463)  评论(0编辑  收藏  举报