1
NSManagedObject *parent = [NSEntityDescription insertNewObjectForEntityForName:@"Parent" inManagedObjectContext:self.managedObjectContext];
NSManagedObject *child = [NSEntityDescription insertNewObjectForEntityForName:@"Child" inManagedObjectContext:self.managedObjectContext];
[child setValue:parent forKey:@"parent"];
나를 위해 작동하지 않는 것,하지만 난 이런 식으로 뭔가를 할 수
: 도움을저장되지 않은 NSManagedObject에 관계를 추가 하시겠습니까?
[child setValue:"John" forKey:@"name"];
감사합니다!
- 그게 무슨이다 나는하고있다.하지만 절약 할 수는 없다. 내가해야할 일이 틀림 없어. 도와 주셔서 감사합니다! – Andrew
핵심 데이터에서 하위 개체로 설정된 관계 대상을 갖고 있습니까? – MobileOverlord
나는 부모와 자식 사이의 일대 다 (One to Many) 설정과 자식과 부모 간의 일대 다 설정을 가지고 있습니다. 아이들은 부모가 하나뿐입니다. – Andrew