筆記:
首先打開Terminal,輸入 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];
遇到問題:創建文件之后,會進入vim插入模式 左下角顯示--INSERT--,,
esc 退出(插入模式)命令
:wq 保存并退出
該步驟其實是為lldb設置了4個別名,為了后續方便操作,這4個別名意義如下:
reveal_load_sim
為模擬器加載reveal調試用的動態鏈接庫
reveal_load_dev
為真機加載reveal調試用的動態鏈接庫
reveal_start
啟動reveal調試功能
reveal_stop
結束reveal調試功能
接下來,我們在AppDelegate類的 application: didFinishLaunchingWithOptions:
方法中,作如下3步操作(如下圖所示):
點擊該方法左邊的行號區域,增加一個斷點,之后右擊該斷點,選擇“Edit Breakpoint”。
點擊”Action”項邊右的”Add Action”,然后輸入“reveal_load_sim”
勾選上Options上的”Automatically continue after evaluating”選項。
2016-10-29 下午3.20.13.png
之后我們運行模擬器,然后打開Reveal,就可以在Reveal界面的左上角,看到有模擬器可以連接調試,選擇它,則可以在Reveal中查看和調試該iOS程序的界面了。
參考鏈接1
參考鏈接2
12.1號更新 詳細的集成程序員鈣片吃多了