MLeaksFinder
MLeaksFinder copied to clipboard
viewController,只有下面的代码,会提示循环引用:
- (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; UITextField *ssearchTextField = [[UITextField alloc] init]; [self.view addSubview:ssearchTextField]; }
push进入的界面
[self.navigationController pushViewController:search animated:YES];
加 UITextField 貌似就会提示
11.2开始 textfield会误报泄漏
不是 MLeaksFinder 的误报。苹果开发者论坛里讨论过这个问题,证实是 iOS 11.2 的 bug。
NSObject+MemoryLeak.h 里暴露了一个白名单方法:
+ (void)addClassNamesToWhitelist:(NSArray *)classNames;
可以通过这个方法把 UITextField 排除在检查范围外。