您好,欢迎来到要发发知识网。
搜索
您的当前位置:首页iOS11 UITextField 内存泄露retainCycl

iOS11 UITextField 内存泄露retainCycl

来源:要发发知识网

项目中使用 'MLeaksFinder',提示UITextField leak,

临时打了个补丁解决iOS11 下UITextField 私有变量的retaincycle

- (void)willMoveToWindow:(UIWindow *)newWindow

{

    [super willMoveToWindow:newWindow];

    if (@available(iOS 11.0, *)) {//a temp solution to fix { UITextField private-var retaincycle.}

        if (!newWindow) {

            NSString *keyPath = @"textContentView.provider";

            [self.passwordTextField setValue:nil forKeyPath:keyPath];

        }

    }

}

Copyright © 2019- net188.cn 版权所有 湘ICP备2022005869号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务