使用MLeaksFinder遇到iOS 11下的误报

具体问题原由可以参考这个issue

https://github.com/Tencent/MLeaksFinder/issues/80

比较喜欢这个库,为了解决问题,参考了别人的解决办法

增加了分类进行解决:

#import <UIKit/UIKit.h>

@interface UITextField (MemoryLeak)

@end
#import "UITextField+MemoryLeak.h"
#import "NSObject+MemoryLeak.h"

@implementation UITextField (MemoryLeak)

#ifdef __IPHONE_11_0
- (BOOL)willDealloc {
    if (@available(iOS 11.0, *)) {
        return NO;
    } else {
        return YES;
    }
}
#endif

@end

One Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s