iOS集成Reveal

2018-10-29  本文已影响85人  暮归倾城

Reveal破解版下载链接

Reveal集成有三种方法:

一、CocoaPods集成Reveal(推荐)

CocoaPods是第三方库的管理工具,CocoaPods安装和使用教程

CocoaPods配置完毕后,在Podfile文件中添加
pod 'Reveal-SDK', :git => 'https://git.coding.net/kakukeme/Reveal-SDK.git', :configurations => ['Debug']
Reveal在正式发版中并不需要,所以通过configurations设置只在debug模式下使用

优点
缺点

二、framework集成Reveal(极度不推荐)

该方法需要预先下载Reveal的framework,手动添加到项目中,该方法弊端太多,不细讲,只吐槽。

弊端:
三、LLDB集成(推荐)
  1. 给项目添加一个断点,运行项目,触发断点


    image.png
  2. 查找Reveal动态链接库的位置
    找到Reveal,通常是应用程序里,也有可能在Download里,这个要自己安装时到底放在哪里了


    Reveal的位置

右键"显示包内容"——Contents——SharedSupport——iOS-Libraries
看一下这个目录下面有没有libReveal.dylib

Reveal4.0及之后,该目录下只有RevealServer.framework
解决方法:
将RevealServer.framework中的RevealServer复制到iOS-Libraries目录之后,改名为libReveal.dylib

由此得到libReveal.dylib的路径备用(因人而异):
/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib

  1. 在Xcode——LLDB中输入(注意更换路径)
    expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2) : ((void*)0)
    等有反馈后继续输入
    expr (void)[(NSNotificationCenter *)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
    如果显示INFO: Reveal Server started. 代表Reveal启动成功。

    然后放开断点。


    image.png
简化命令--为LLDB命令设置别名

每次启动Reveal都输入上面两条命令太过繁琐,可以给这两条命令设置别名

打开终端,vim ~/.lldbinit ,然后输入

command alias reveal_load_sim expr (Class)NSClassFromString(@"IBARevealLoader") == nil ? (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2) : ((void*)0)

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];

reveal_load_sim:为模拟器加载动态链接库(真机不能用)
reveal_start:启动reveal调试
reveal_stop:结束reveal调试

保存后重启Xcode之后,即可以使用别名:


image.png
优点
缺点
上一篇 下一篇

猜你喜欢

热点阅读