Skip to content

11.2 以后 使用了textField的地方就报泄漏 #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zb1006801184 opened this issue Feb 28, 2018 · 6 comments
Open

11.2 以后 使用了textField的地方就报泄漏 #89

zb1006801184 opened this issue Feb 28, 2018 · 6 comments

Comments

@zb1006801184
Copy link

11.2 以后 使用了textField的地方就报泄漏 ,这什么情况,有一样情况的嘛

@billding211
Copy link

    if #available(iOS 11.2, *)
    {
        let keyPath = "textContentView.provider"
        if self.window != nil {
            let provider = self.value(forKeyPath: keyPath)
            if provider == nil {
                self.setValue(self, forKeyPath: keyPath)
            }
        }else{
            self.setValue(nil, forKeyPath: keyPath)
        }
    }

https://www.jianshu.com/p/5add8d20f8a1?from=timeline&isappinstalled=0
可以解决.

@xlsd
Copy link

xlsd commented Mar 21, 2018

这样虽然能解决,但是,给业务代码带来了风险,得不偿失。

@liuchunlao
Copy link

push过去有三个文本框后,如果不点击文本框,,会释放3次。一切ok
然后如果点击后,就算不编辑内容,返回的时候就会报泄露了。。
登录跳转注册,然后返回时就出现了。

@liuchunlao
Copy link

再次push时,又会提示大家都释放了。

@AgoniNemo
Copy link

现在有更好的解决方案吗?这个也看过了issues,最后一个回复里,可以看到有一个比较好的方案,但是要引入两个库,感觉有点重

@miniLV
Copy link

miniLV commented Jun 11, 2018

其实控制器还是会被dealloc,通过Debug Memory Graph查看该控制器是释放的, 但是alert 会弹出,提示retain cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants