我会投票赞成“做错事”。:) 我只是尝试了一个项目的最简单形式,一个 ItemCategory,没有属性,没有其他实体,他们自己的关系......它没有显示出这种症状。这个...
Project *p = [NSEntityDescription insertNewObjectForEntityForName:@"Project" inManagedObjectContext:self.managedObjectContext];
ItemCategory *c1 = [NSEntityDescription insertNewObjectForEntityForName:@"ItemCategory" inManagedObjectContext:self.managedObjectContext];
ItemCategory *c2 = [NSEntityDescription insertNewObjectForEntityForName:@"ItemCategory" inManagedObjectContext:self.managedObjectContext];
c1.category = c2;
c1.project = p;
...给...
(lldb) po c1.category (ItemCategory *) $2 = 0x06b98bd0 <ItemCategory: 0x6b98bd0> (entity: ItemCategory; id: 0x6b98ee0 <x-coredata:///ItemCategory/tB2F1219F-4FA5-48DA-871E-D9F9DC8E33E34> ; data: {
category = nil;
project = nil;
subcategories = (
"0x6b82280 <x-coredata:///ItemCategory/tB2F1219F-4FA5-48DA-871E-D9F9DC8E33E33>"
); })
(lldb) po c1.project (Project *) $3 = 0x06b97a20 <Project: 0x6b97a20> (entity: Project; id: 0x6b97a70 <x-coredata:///Project/tB2F1219F-4FA5-48DA-871E-D9F9DC8E33E32> ; data: {
categories = (
"0x6b82280 <x-coredata:///ItemCategory/tB2F1219F-4FA5-48DA-871E-D9F9DC8E33E33>"
); })
不幸的是,这并没有说明什么可能是错误的,但它似乎并不是天生的限制。