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中看到项目了,亲测成功。

 


 

posted @ 2017-03-21 15:18  码锋窝  阅读(1607)  评论(0编辑  收藏  举报