2014-09-22 111 views
0
{ "lastUpdated":0, "firstItemParent":{ "title":"Item 1 title", "text":"Item 1 text", "firstItemList":[ { "title":"Kitchen" }, { "title":"Lounge" }, { "title":"Bathroom" }, { "title":"Garage" } ] } } 

需要为接收到的此数据编写RestKit映射。任何人都可以帮助我解决这个问题。下面的Json文件的RestKit映射

我试图使firstItemParent元素作为一个类,并尝试firstItemList作为路径没有任何工作,我是新的restkit映射。

+2

粘贴一些代码你到目前为止试过的东西.. – Bharat 2014-09-22 12:02:01

回答

0

首先,您需要创建映射模型类,根据JSON映射类和下面显示的属性。

Class ResponseModel 
      @property (assign,nonatomic) int lastUpdated; 
      @property (strong, nonatomic) FirstItemParent *firstItemParent; 

    Class FirstItemParent 
     @property (strong, nonatomic) NSString *title; 
     @property (strong, nonatomic) NSString *text; 
     @property (strong, nonatomic) NSMutableArray *firstItemList; 

    Class FirstItemList 
     @property (strong, nonatomic) NSString *title; 

创建模态类后,您必须编写关系映射到它。