iOS企业级开发实用技术iOS程序猿iOS Developer

Apple隐藏的Debug利器UIDebuggingInform

2017-05-27  本文已影响182人  b9bd2a64f47e
2017-05-27 13_29_35.gif
#ifdef DEBUG//因为这个是私有的api,一定要保证上线时的包中不包含这段代码!
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    id debugClass = NSClassFromString(@"UIDebuggingInformationOverlay");//获得对象
    [debugClass performSelector:NSSelectorFromString(@"prepareDebuggingOverlay")];//开启调试模式
#pragma clang diagnostic pop
#endif
Snip20170527_2.png
#ifdef DEBUG//因为这个是私有的api,一定要保证上线时的包中不包含这段代码!
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
    id debugClass = NSClassFromString(@"UIDebuggingInformationOverlay");//获得对象
    [debugClass performSelector:NSSelectorFromString(@"prepareDebuggingOverlay")];//开启调试模式

    id debugOverlayInstance = [debugClass performSelector:NSSelectorFromString(@"overlay")];//手动弹出窗口
    [debugOverlayInstance performSelector:NSSelectorFromString(@"toggleVisibility")];
#pragma clang diagnostic pop
#endif
上一篇 下一篇

猜你喜欢

热点阅读