- 使用终端,创建.lldbinit
$vim ~/.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 个别名,为了后续方便操作,这 4 个别名意义如下:
reveal_load_sim
为模拟器加载 reveal 调试用的动态链接库
reveal_load_dev
为真机加载 reveal 调试用的动态链接库
reveal_start
启动 reveal 调试功能
reveal_stop
结束 reveal 调试功能
- 在项目中AppDelegate类的
application:didFinishLaunchingWithOptions:方法中添加断点
- 新增一个断点,编辑断点
Edit Breakpoint
- 点击
Action
右边的Add Action
输入"reveal_load_sim" - 勾选
Options
上的"Automatically continue a er evaluating"
- 运行项目,打开Reveal选择相应模拟器
关于在Swift中使用Reveal报错问题
error: :1:8: error: consecutive statements on a line must be separated by ';'
解决方法:删除(void)*
command alias reveal_load_sim expr dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2)
网友评论