使用Reveal 分析iOS APP UI

Reveal作为分析APP UI的利器,确实非常好用,用来查看任意UI布局也很方便

Reveal配置
  • 首先从Reveal官网(https://revealapp.com/) 下载APP并安装,把Reveal拖到Applications目录。(建议使用Reveal 1.6.3版本)
  • 打开Reveal,找到Reveal--Help--Show Reveal Library in Finder--iOS Library目录下的libReveal.dylib,默认路径为:/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib
  • 打开Xcode,找到 View → Navigators → Show Breakpoint Navigator
  • 在左下角点击“+”号,选择Add Symbolic Breakpoint
    Add Symbolic Breakpoint
  • Symbol框里填写UIApplicationMain
  • 点击Add Action按钮,并且确保Action选项是Debugger Command
  • 复制以下文本填写在Add Action下面的文本框。
    对于 iOS targets
expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void *)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2) : ((void*)0)

对于 tvOS targets:

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

上面两个代码中的路径请自行替换成Reveal的动态库的路径,对于iOS Library,是上面(2)我们找到的默认路径/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib

tvOS请自行替换。

如下图所示:

勾选 Automatically continue after evaluating actions 选项

  • 右键点击刚刚创建的断点,并且选择 Move Breakpoint To → User
    如下图所示:


现在可以重新运行Xcode,并且在Reveal 选择需要查看的目标APP。

延长Reveal试用时间

对于官网下载的Reveal,默认给予的是30天的使用限制,2.0版本只有15天的使用限制。
我们可以通过以下方式,延长使用时间:

  • 退出Reveal
  • 输入以下命令
killall cfprefsd
rm -rf ~/Library/Preferences/com.ittybittyapps.Reveal.plist
  • 重启Mac (可以省略)

这样我们的Reveal 试用时间就又恢复到了30天。

添加新评论

电子邮件地址不会被公开,评论内容可能需要管理员审核后显示。