【发布时间】:2012-05-17 06:18:25
【问题描述】:
在一个 ARC 项目中,我在 viewDidLoad: 和 removeObserver: 中 addObserver 在 dealloc 中获取通知。但是在我弹出viewController之后,dealloc没有被执行。
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(refreshData)
name:MyNotification
object:nil];
}
- (void)dealloc
{
NSLog(@"==================");//There is nothing print out.
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MyNotification
object:nil];
}
谢谢。
【问题讨论】:
标签: iphone objective-c automatic-ref-counting