当我尝试将孩子插入我的NSTreeController
.
NSTreeController *tree = [NSTreeController new];
NSTreeNode *node1 = [NSTreeNode treeNodeWithRepresentedObject:@{ @"type": @"shirt" }];
// The below method causes mysterious crash
[tree insertObject:node1 atArrangedObjectIndexPath:[NSIndexPath indexPathWithIndex:0]];
Xcode 说:
* 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“[对象类:NSMutableDictionary] 无法执行操作,因为 childrenKeyPath 为 nil”*
为什么会导致此错误?什么是 childrenKeyPath,我为什么需要它(我没有使用界面生成器)?