Reveal是一款不需要重新运行项目,就可以动态调试程序UI界面的工具。
项目中添加Reveal framework进行使用
-
打开Reveal,通过Help - Show Reveal Library In Finder - iOS Library,找到RevealServer.framework
RevealServer.framework
-
将RevealServer.framework拷贝到项目文件中,并添加到项目里
添加至项目
-
工程配置Build Settings - Other Linker Flags增加-ObjC、-framework、RevealServer
Other Linker Flags
然后运行项目,发生崩溃,报错
dyld: Library not loaded: @rpath/RevealServer.framework/RevealServer
Referenced from: /Users/liumingfei/Library/Developer/CoreSimulator/Devices/C192F1C0-C2FA-4C80-A46C-DA32EC1755C5/data/Containers/Bundle/Application/B12DEA41-B4D0-475E-AA60-2C4051E2DD88/20200308-数据结构&算法.app/20200308-数据结构&算法
Reason: image not found
通过Build Phases 中新增 New Copy Files Phase,然后将Destination设置为frameworks,点击+,添加RevealServer.framework
![](https://img.haomeiwen.com/i13407924/cd1a5e5e01b36b86.png)
再次运行项目,运行成功后,打开Reveal,然后打开对应的关联应用即可
![](https://img.haomeiwen.com/i13407924/e37d044e8c501673.png)
可以查看View的结构了
![](https://img.haomeiwen.com/i13407924/f061f4e0387a666f.png)
无侵入使用
打开.lldbinit文件,然后编辑,新增
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
使用修改生效
command source .lldbinit
打开对应工程,在application:didFinishLaunchingWithOptions:方法中执行如下操作:
-
增加一个断点
增加断点
-
右击,选择Edit Breakpoint
Edit
-
点击Add Action
Add Action
-
添加内容reveal_load_sim,并勾选Automatically continue a er evaluating
reveal_load_sim
然后运行项目,打开Reveal,打开相关应用即可,这种方案无侵入,推荐使用
越狱设备查看任意App
方法一
-
Mac端,打开Reveal,在Help->Show Reveal Library in Finder - iOS Library找到RevealServer.framework,然后打开RevealServer.framework找到里面的RevealServer文件,copy一份到自己的目录下然后重命名为RHRevealLoader.dylib
-
iPhone在Cydia中安装Reveal Loader,重启Spring Board
Reveal Loader
-
将RHRevealLoader.dylib可执行文件拷贝到/Library/MobileSubstrate/DynamicLibraries目录下,防止设备上动态库版本与电脑上版本不一致
scp /Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer root@192.168.1.5:/Library/MobileSubstrate/DynamicLibraries/RHRevealLoader.dylib
-
iPhone 设置 - Reveal - Enabled Applications 打开想要查看的App即可
设置
Reveal
方法二
- Mac端,打开Reveal,在Help->Show Reveal Library in Finder - iOS Library找到RevealServer.framework,然后打开RevealServer.framework找到里面的RevealServer文件,copy一份到自己的目录下然后重命名为reveal2Loader.dylib
-
iPhone在Cydia中安装Reveal2Loader,重启Spring Board
Reveal2Loader
- 将reveal2Loader.dylib可执行文件拷贝到/Library/MobileSubstrate/DynamicLibraries目录下,防止设备上动态库版本与电脑上版本不一致
scp /Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer root@192.168.1.5:/Library/MobileSubstrate/DynamicLibraries/reveal2Loader.dylib
- iPhone 设置 - Reveal - Enabled Applications 打开想要查看的App即可
方法三
- Mac端,打开Reveal,在Help->Show Reveal Library in Finder - iOS Library找到RevealServer.framework,然后打开RevealServer.framework找到里面的RevealServer文件,copy一份到自己的目录下然后重命名为libReveal.dylib
- 生成libReveal.plist文件,其中Bundles为目标应用的BundleID数组,如果不配置改文件,则会监测所有应用导致设备卡顿
{
Filter = {
Bundles = (
"com.xxx.xxx",
);
};
}
- 将libReveal.dylib可执行文件拷贝到/Library/MobileSubstrate/DynamicLibraries/目录下
打开设置的App,查看效果
![](https://img.haomeiwen.com/i13407924/6a6d6d655278247f.png)
![](https://img.haomeiwen.com/i13407924/17e6e9b5791a8cb9.png)
大功告成!!!
生活如此美好,今天就点到为止。。。
网友评论