iOS 測試工具reveal可視化調試工具的使用


簡單翻譯一下reveal可視化圖形工具插入項目的官方文檔(官方英文版file:///Applications/Reveal.app/Contents/SharedSupport/Documentation/Load%20Reveal%20Without%20Changing%20Your%20Xcode%20Project.html)

官方有好幾種方法,這里主要推薦兩種方法。

一.打斷點(此方法只對模擬器有效果,真機請看方法二)

01-打開項目之后,來到打斷點界面。Add Symbolic Breakpoint.

02-edit-Breakpoint中輸入一下信息

UIApplicationMain

Add Action button----》Debugger Command

expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void *)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2) : ((void*)0)

03-在斷點右擊---》選User

04-運行項目,在模擬器的項目就可以在Reveal中看到了。此斷點在一個項目完成設置之后,在另一個項目也可以生效,並不需要每個項目都設置一次。

二.導入frame法(真機和模擬器都有效)

本方法只對進行過設置的項目才有效,有就是說每個項目需要設置一次,因為是在真機運行,而且模擬器運行的也是每個項目需設置一次。

(官方說明:file:///Applications/Reveal.app/Contents/SharedSupport/Documentation/Integrating%20Reveal%20Linking.html)

01-啟動Reveal並打開library目錄

02-將RevealServer.framework復制到項目的根目錄,特別提醒:在拖到這個文件的時候記得按着option鍵拖到,不然只是一個引用,編譯的時候會出錯,打開項目。

 

03-選中項目target --- 》Build Settings----》搜索Framework Search Paths---》將$(inherited) $(SRCROOT)填進去

04-Build Settings---->Other Linker Flags--->填入-ObjC -weak_framework RevealServer

05-Build Settings---->Runpath Search Paths--->填入$(inherited) @executable_path/Frameworks,我的項目本身就填有這個,略過了。

06-Build Phases --》點擊+添加Run Script phase

復制下面的內容到描述里

 export REVEAL_SERVER_FILENAME="RevealServer.framework"

 # Update this path to point to the location of RevealServer.framework in your project.
 export REVEAL_SERVER_PATH="${SRCROOT}/${REVEAL_SERVER_FILENAME}"

 # If configuration is not Debug, skip this script.
 [ "${CONFIGURATION}" != "Debug" ] && exit 0

 # If RevealServer.framework exists at the specified path, run code signing script.
 if [ -d "${REVEAL_SERVER_PATH}" ]; then
   "${REVEAL_SERVER_PATH}/Scripts/copy_and_codesign_revealserver.sh"
 else
   echo "Cannot find RevealServer.framework, so Reveal Server will not be started for your app."
 fi

07-打開項目,運行,就可以在reveal中看到項目了,親測成功。

 

 
        

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM