1.尝试运用了新探索的调试工具InjectionIII
看了这个作者的https://blog.csdn.net/ws1836300/article/details/103237430
进行了相关调试
1:从App Store下载
在App Store搜索InjectionIII,出来的小护士拿的针筒标志的就是没错啦。
2:从github下载
Git地址,并且这么好用的工具竟然是开!源!的!正是有了github上这么多开源共享的大神们,代码的世界才变得越来越简单、高效、美好。
步骤二:
1.设置AppDelegate.m
打开你的源码,在AppDelegate.m的didFinishLaunchingWithOptions方法添加一行代码:
直接加:
[[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"] load];
或者加:
#if DEBUG
// iOS
[[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"] load];
// tvOS
//[[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle"] load];
// macOS
//[[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle"] load];
#endif
2.关于要不要在ViewController.m 文件里 里加- (void)injected 方法,我暂时没有加:
不过你可以加上
- (void)injected{
//写入代码的声明周期调用过程基本可以覆盖所有的界面修改
[self viewWillAppear:Yes];
[self viewDidLoad];
[self viewWillDissAppear:Yes];
...
}
原文链接:https://blog.csdn.net/ws1836300/article/details/103237430