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


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框架,并將它放入您項目的根目錄。


2.配置您的Xcode工程:
配置1:Targets->Build Setting->Search Paths->Framework Search Paths->Dubug->鍵入:
$(inherited) $(SRCROOT);
配置2:Targets->Build Setting->Other Linker Flags->Dubug->鍵入:
-ObjC -weak_framework RevealServer
配置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

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

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

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
