我的应用程序随机崩溃,因为我已经使用KVO进行NSOperationQueue。我确实运行了仪器,发现ARC保留计数情况。
这是我的代码。
@try
{
[[ApplicationManager sharedInstance].operationsQueue removeObserver:self forKeyPath:@"operations"];
}
@catch( NSException *exception )
{
//NSLog(@"caught exception trying to remove an observer we are not observing");
}
[[ApplicationManager sharedInstance].operationsQueue addObserver:self forKeyPath:@"operations" options:0 context:NULL];
如果有人可以指出正确的方向,那就太棒了。