我在使用 NSArrayController rerangeObjects 函数时遇到了问题 - 这个函数是从一些后台踏板调用的,有时应用程序会因错误而崩溃:'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"];
}