Reveal的使用

iOS应用开发中,可以使用Reveal查看视图的层级以及修改视图的属性(虽然xcode自带的工具也可以查看,但是功能却没有Reveal强大),还可以使用越狱手机查看其它应用的结构等.

提供一个Reveal的下载地址:Reveal

模拟器调试

  • 1.在XCode中选择ViewNavigatorsShow Breakpoint Navigator.
  • 2.添加Symbolic Breakpoint
  • 3.Symbol中填入UIApplicationMain
  • 4.选择Add Action按钮
  • 5.填入下列内容
expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void *)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2) : ((void*)0)
  • 6.勾选Automatically continue after evaluating actions
BreakPoint
  • 7.右键选择断点,选择Move Breakpoint ToUser
  • 8.在XCode中运行程序

#### 真机调试(未越狱)

  • 1.查找RevealServer.framework所在位置,在RevealHelpShow Reveal Library in Finder
RevealServer.framework
  • 2.将RevealServer.framework拷贝到项目的根目录中
  • 3.使用XCode打开项目,选择要操作的TARGETS
image.png
  • 4.选择Build Settings,在Framework Search PathsDebug模式下设置:
$(inherited) $(SRCROOT)
Framework Search Paths
  • 5.选择Build Settings,在Runpath Search PathsDebug模式下设置:
$(inherited) @executable_path/Frameworks
  • 6.选择Build Phases,添加Run Script
Run Script
  • 7.在Run Script添加如下代码
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
  • 8.在Debug模式下运行项目
    Reveal.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容