鏈接模擬器的使用
鏈接模擬器進行調試的方法有很多,不過這種方法是不需要更改工程文件的。
1. 首先,打開Terminal,輸入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];
- reveal_load_sim 為模擬器加載reveal調試用的動態鏈接庫
- reveal_load_dev 為真機加載reveal調試用的動態鏈接庫
- reveal_start 開始reveal調試
- reveal_stop 結束reveal調試
2. 然后在AppDelegate類的application: didFinishLaunchingWithOptions:
中添加斷點,并添加action reveal_load_sim
,并勾選上下面的選項,運行模擬器,打開reveal就能找到要鏈接的程序。
鏈接真機的使用
打開Reveal的help,找到動態鏈接庫libReveal.dylib,將之拖到工程中,并把它從Link Binary with Library
中拖到 Copy Boundle Resource
中,然后將之前action中的reveal_load_sim
改為reveal_load_dev
即可。