message sent to deallocated instance

来源:互联网 发布:linux显示时间命令 编辑:程序博客网 时间:2024/05/21 19:18
最近写一个新的项目,不知道是由于代码质量问题,还是其他同事的原因,还是设备的问题,在iphone5s上经常出现这个问题:message sent to deallocated instance.下面说下解决这个问题引发的主要原因:1.nstimer没有停掉     退出这个页面时,delloc里释放2.block里面调用了self 没有用_weak去修饰 3.delegate没有用weak修饰    退出这个页面时,delloc里把delegate设为nil4.notification没有释放    退出这个页面时,delloc里把把你接受到的notification释放,如果还不行,那就    [[NSNotificationCenter defaultCenter] removeObserver:self];把所有都释放.
0 0