Core Data relationships not mapped with RESTkit

前端 未结 1 1640
悲哀的现实
悲哀的现实 2021-02-11 02:02

I am struggling to get a proper mapping of Core Data relationships using RESTkit 0.20.0-pre6.

I want to map this JSON:

{ \"items\" : [ {\"id\" : 2001, \"         


        
1条回答
  •  感动是毒
    2021-02-11 02:54

    I got it working. The trick was to add an extra attribute 'roomId' on ItemMO for the foreign key.

    Entity ItemMO (Attributes "id", "roomId", "itemAttr1", Relationship "room" to RoomMO)
    

    Then tell RESTkit about the relation:

    [itemMapping addConnectionForRelationship:@"room" connectedBy:@{@"roomId" : @"id"}];
    

    It seems as if RESTkit cannot establish the relation without the extra foreign key attribute.

    0 讨论(0)
提交回复
热议问题