【发布时间】:2012-01-17 07:50:04
【问题描述】:
我有以下代码在加载视图时添加了一个观察者。
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserverForName:@"com.app.livedata.jsonupdated"
object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
NSLog(@"JSONUPDATED");
}];
}
这很好。但是,当视图被卸载并且我确认调用了 dealloc 时,通知仍在触发。
好像没有关闭这个观察者的方法?
【问题讨论】:
标签: ios nsnotifications