Xcode8 Swift3 使用Reveal

很久没调试UI了,由于新的工程采用全程Swift编写,可预知的是Reveal的dlib加载方式已经扑街了(实际测试确实扑街)。

晚上搜了下,貌似这玩意儿就国内玩的人多,网上教程也比较旧,基本上都是dylib的断点加载方式,对于Reveal 2以后的版本都是采用的Framework加载。

老版本(dylib)-> ~/.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 nil];

更新:2017-03-19
Reveal 2以后的新版本(Framework)-> ~/.lldbinit

Objective-C:

command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"RevealServer" ofType:@"framework"] 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 nil];

Swift:

command alias swift_reveal_load_sim expr dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/RevealServer.framework/RevealServer", 2)
command alias swift_reveal_load_dev expr dlopen(NSBundle.mainBundle().pathForResource("RevealServer", ofType: "framework")!, 2)
command alias swift_reveal_start expr NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStart", object: nil)
command alias swift_reveal_stop expr NSNotificationCenter.defaultCenter().postNotificationName("IBARevealRequestStop", object: nil)

你可能感兴趣的:(Xcode8 Swift3 使用Reveal)