gpt4 book ai didi

iphone - NSNotificationCenter 发布到 nil -> 崩溃

转载 作者:行者123 更新时间:2023-11-28 20:40:05 25 4
gpt4 key购买 nike

我的 TableViewCell 注册通知。但是我不能取消注册,因为我不知道什么时候。我试图将 NSNotificationCenter 子类化,但我没有以正确的方式尝试它。

如何解决这个问题的一些想法?

最佳答案

这里的问题是 UITableViewCell 很少得到 dealloc

通常你想要的是在子类的 prepareForReuse 方法中调用 [[NSNotificationCenter defaultCenter] removeObserver:self]。 (一定要在你的实现中调用[super prepareForReuse];!)

关于iphone - NSNotificationCenter 发布到 nil -> 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8980123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com