2
RESTkit 0.20.0-pre6을 사용하여 핵심 데이터 관계를 올바르게 매핑하는 데 어려움을 겪고 있습니다.핵심 데이터 관계가 RESTkit으로 매핑되지 않았습니다.
Entity ItemMO (Attributes "id", "itemAttr1", Relationship "room" to RoomMO)
Entity RoomMO (Attributes "id", Relationship "items" to ItemMO)
속성이 잘 매핑되지만 관계는 비어 : 해당 코어 데이터 모델에
{ "items" : [ {"id" : 2001, "itemAttr1" : "..."}, ...<more items>... ],
"rooms": [ {"id" : 3001, "items": [2001, ...<more item id's>...] }
:
나는이 JSON을 매핑 할.
이 코드 사용하여 설명 here로 RKConnectionDescription
를 사용하여 시도했다 :
[itemMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:nil toKeyPath:@"room" withMapping:roomMapping]];
나는 간단하게 뭔가를 놓친해야합니다 나는 또한 아무 소용 간단한 RKRelationshipMapping
를 사용하여 시도
NSEntityDescription *roomEntity = [NSEntityDescription entityForName:@"RoomMO" inManagedObjectContext:self.context];
NSRelationshipDescription *itemsInRoom = [roomEntity relationshipsByName][@"items"];
RKConnectionDescription *connection = [[RKConnectionDescription alloc] initWithRelationship:devicesInRoom keyPath:@"devices"];
[roomMapping addConnection:connection];
을 이것은 RESTkit의 이국적인 사례가 아니어야합니다. 어떤 아이디어?
+1 여분의 외래 키 속성없이이 매핑을 수행하도록 RESTKit의 용량을 명시 적으로 배제하고 있습니다. –