RestKit动态映射

时间:2012-05-22 19:57:45

标签: ios restkit

我需要将此数据映射到一个Core Data对象(EventList)。

{
 "eventList":[
  {
     "code":"hhel444440lhxxxxxn",
     "name":"Test Event",
     "id":"222495710159sdfdfd8000000",
     "status":"Open",
     "urls":[
        {
           "hostURL":"mything.association.somedomain.com",
           "module":"association",
        },
        {
           "hostURL":"mything.mobile.somedomain.com",
           "module":"mobile",
        }
     ]
  }
 ]
}

======我需要将它映射到我班上的这些属性===========

@dynamic code;
@dynamic name;
@dynamic id;
@dynamic status;
@dynamic hostURL;

如果module == mobile的值,则只应映射hostURL,因此在这种情况下,我们不希望来自第一个url的url,其中module == association。我们需要跳过第一个。

我正在尝试使用DynamicMapping,但是当我尝试动态映射时,我得到了:

valueForUndefinedKey:]:实体(null)不是密钥“hostURL”的密钥值编码。'

1 个答案:

答案 0 :(得分:0)

知道了。我正在剪切和粘贴我在错过的更改中编写的其他代码。