ios通知“死”的对象
我有一些UIViews进入视图,然后走出看法和未使用。 不过,我相信其中一些人在收到通知后,即使在他们离开后也会造成问题。
在UIView“父”容器上:
if(self._content != nil && [self._content respondsToSelector:@selector(presentMe:)]) { [self._content presentMe:NO]; }
在UIView“孩子”:
[[NSNotificationCenter defaultCenter] <-- EXC_BAD_ACCESS (code=1, address=0x70000008 postNotificationName:PRESENTING object:self userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:prepareToEnter], PRESENTING, nil]];
一切工作都是第一次,但如果我第二次启动相同的视图,我会得到一个EXC_BAD_ACCESS。 这不是说有什么缺失吗?
仅供参考,这是所有在ARC – Xcode 4.3.2
如果您在视图中为项目调用addObserver
,则需要在dealloc期间调用removeObserver
。 即使与ARC。