2014-09-22 114 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; 

創建模態類後,您必須編寫關係映射到它。