我有一个NSArrayController的rearrangeObjects功能的麻烦 - 该功能由一些背景胎面,有时应用程序错误崩溃叫:“叫endUpdates没有beginUpdates”。
我怎样才能检测是否arrayController在当前时刻清理对象,并添加下一重排一些像队列或取消当前的清理和运行新的?
可能有此问题的另一个解决方案?
编辑程式码:
TableController implementation:
- (void)setContent{//perfoms on main thread
//making array of content and other functions for setting-up content of table
//...
//arrayController contains objects of MyNode class
//...
//end of setting up. Call rearrangeObjects
[arrayController rearrangeObjects];
}
- (void)updateItem:(MyNode *)sender WithValue:(id)someValue ForKey:(NSString *)key{
[sender setValue:someValue forKey:key];
[arrayController rearrangeObjects];//exception thrown here
}
MyNode implementation:
- (void)notifySelector:(NSNotification *)notify{
//Getted after some processing finished
id someValue = [notify.userInfo objectForKey:@"observedKey"];
[delegate updateItem:self WithValue:someValue ForKey:@"observedKey"];
}