title: Restkit mapping arrays to core data
body: <p>I have the following JSON:</p>
  
  <pre><code>{
      "id": 1,
      "editable": true,
      "number": "1",
      "name": "Text here",
      "banner": "Text here",
      "address": "Text here",
      "city": "Text here",
      "contact": "Text here",
      "latitude": "Text here",
      "longitude": "Text here",
      "banner_id": 5,
      "hours": [
          {
              "day": "monday",
              "start": "8:00am",
              "end": "5:00pm"
          },
          {
              "day": "tuesday",
              "start": "",
              "end": ""
          },
          {
              "day": "wednesday",
              "start": "",
              "end": ""
          },
          {
              "day": "thursday",
              "start": "",
              "end": ""
          },
          {
              "day": "friday",
              "start": "",
              "end": ""
          },
          {
              "day": "saturday",
              "start": "",
              "end": ""
          },
          {
              "day": "sunday",
              "start": "",
              "end": ""
          }
      ]
  }
  </code></pre>
  
  <p>I am trying to create a mapping of this object which contains an array of hours, my code is as follows:</p>
  
  <pre><code>RKObjectMapping* hoursMapping = [RKObjectMapping mappingForClass:[Hours class] ];
      [hoursMapping addAttributeMappingsFromArray:@[ @"day", @"start", @"end"]];
  
      RKObjectMapping* storeMapping = [RKObjectMapping mappingForClass:[Store class] ];
      [storeMapping addAttributeMappingsFromArray:@[ @"id", @"editable", @"number", @"name", @"banner", @"address", @"city", @"contact", @"latitude", @"longitude", @"banner_id"]];
  
      [storeMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"hours"
                                                                                 toKeyPath:@"hours"
                                                                               withMapping:hoursMapping]];
  
      RKResponseDescriptor *storeResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:storeMapping
                                                                                          method:RKRequestMethodAny
                                                                                     pathPattern:@"api/v2/stores.json"
                                                                                         keyPath:@""
                                                                                     statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
  </code></pre>
  
  <p>The mapping fails and the only error returned says:
  "The operation couldn't be completed"</p>
  
  <p>What am I doing wrong here? How can I get this to map successfully?</p>
  
  <p>Store.h</p>
  
  <pre><code>@interface Store : NSManagedObject
  
  @property (nonatomic, retain) NSNumber * id;
  @property (nonatomic, retain) NSNumber * editable;
  @property (nonatomic, retain) NSString * number;
  @property (nonatomic, retain) NSString * name;
  @property (nonatomic, retain) NSString * banner;
  @property (nonatomic, retain) NSNumber * address;
  @property (nonatomic, retain) NSString * city;
  @property (nonatomic, retain) NSString * contact;
  @property (nonatomic, retain) NSString * latitude;
  @property (nonatomic, retain) NSString * longitude;
  @property (nonatomic, retain) NSNumber * banner_id;
  @property (nonatomic, retain) NSSet *hours;
  @end
  
  @interface Store (CoreDataGeneratedAccessors)
  
  - (void)addHoursObject:(Hours *)value;
  - (void)removeHoursObject:(Hours *)value;
  - (void)addHours:(NSSet *)values;
  - (void)removeHours:(NSSet *)values;
  
  @end
  </code></pre>
  
  <p>Hours.h</p>
  
  <pre><code>@interface Hours : NSManagedObject
  
  @property (nonatomic, retain) NSString * day;
  @property (nonatomic, retain) NSString * start;
  @property (nonatomic, retain) NSString * end;
  
  @end
  </code></pre>