iOS中的UI調(diào)試工具:Reveal 11集成和使用

Reveal是什么?

Reveal功能類似于Xcode自帶的Debug View Hierarchy(視圖層次結(jié)構(gòu)),但相較于Debug View Hierarchy,Reveal不僅可以直觀的看到UI布局,還能實時的修改它以便達到最佳的顯示效果,就像Firefox中的fireDug一樣。


Xcode自帶界面調(diào)試工具

Reveal

Reveal 11(2017.11最新版)的集成和使用方法

目前有三種集成方法:
1.使用CocoaPods 2.手動將Framework導(dǎo)入工程 3.打斷點

1.使用CocoaPods,不知道CocoaPods的同學(xué)們戳這里

這種方式適合于團隊開發(fā)時開發(fā)人員都使用Reveal的場景。
Podfile需要導(dǎo)入的框架如下:

target 'YourMainAppTargetName' do
    pod 'Reveal-SDK', :configurations => ['Debug']
end

注意:請確保只在調(diào)試環(huán)境下將Reveal Server framework導(dǎo)入到您的環(huán)境中。

configurations => ['Debug']:配置這個參數(shù)可以確保Reveal只會鏈接到你的調(diào)試版本。

2.手動將Framework導(dǎo)入工程

1.從Reveal取出適用于iOS的Revel框架,并將它放入您項目的根目錄。

步驟1:找到存放框架目錄

步驟2:復(fù)制到項目中

2.配置您的Xcode工程:
配置1:Targets->Build Setting->Search Paths->Framework Search Paths->Dubug->鍵入:$(inherited) $(SRCROOT);
配置1

配置2:Targets->Build Setting->Other Linker Flags->Dubug->鍵入:-ObjC -weak_framework RevealServer
配置2

配置3:請確認您的Targets->Build Setting->Runpath Search Paths ->Dubug中有:$(inherited) @executable_path/Frameworks
配置4:Targets->BuildPhases->new Run Script phase 中寫入以下script,并重命名為Integrate Reveal Server

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
配置4

3.關(guān)閉重新打開xcode并運行您的工程,在Reveal中就能看到相應(yīng)的UI布局。

注意:請確認您的電腦和調(diào)試設(shè)備處在同一局域網(wǎng)下

3.打斷點

1.在Reveal中打開Help主菜單->點擊Install Debugger Commands。點擊Continue

2.xcode中添加斷點


添加斷點

3.配置斷點
配置1:Symbol鍵入: UIApplicationMain Action鍵入:reveal load

配置1

配置2:右鍵單擊新創(chuàng)建的斷點,Move Breakpoint To -> User。


配置2

4.真機調(diào)試時額外需要一個步驟:Targets->BuildPhases->new Run Script phase 中寫入以下script,并重命名為Integrate Reveal Server:

REVEAL_APP_PATH=$(mdfind kMDItemCFBundleIdentifier="com.ittybittyapps.Reveal2" | head -n 1)
BUILD_SCRIPT_PATH="${REVEAL_APP_PATH}/Contents/SharedSupport/Scripts/reveal_server_build_phase.sh"
if [ "${REVEAL_APP_PATH}" -a -e "${BUILD_SCRIPT_PATH}" ]; then
   "${BUILD_SCRIPT_PATH}"
else
   echo "Reveal Server not loaded: Cannot find a compatible Reveal app."
fi
真機調(diào)試需要的步驟
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 參考鏈接 添加Reveal 為了讓Reveal能夠在運行時,檢視及調(diào)試您的iOS應(yīng)用,首先您需將Reveal庫文件...
    681916139107閱讀 2,776評論 0 6
  • 前言:Reveal是一個iOS程序界面調(diào)試工具,它能夠在應(yīng)用程序運行過程中調(diào)試應(yīng)用程序界面。通過Reveal我們可...
    風(fēng)_iOSer閱讀 2,252評論 0 2
  • Reveal是iOS開發(fā)工具中的神器之一,它能夠在應(yīng)用程序運行過程中調(diào)試應(yīng)用程序界面。 通過Reveal我們可以連...
    jackfrued閱讀 12,659評論 2 48
  • Reveal Reveal是分析、調(diào)試iOS應(yīng)用UI的利器。 Reveal能夠在運行時調(diào)試和修改iOS應(yīng)用程序。它...
    fakepinge閱讀 1,811評論 0 5
  • 結(jié)婚十一年了,每年就是過年回家一周時間,與家婆相處合計也就不到半年時間。一直我在外都在夸家婆勤勞、老實、人好相處,...
    Joan_zhou閱讀 319評論 0 0

友情鏈接更多精彩內(nèi)容