title: NSData Exception - "incomprehensible archive"
body: <p>So I got an exception while trying to implement <code>NSKeyedUnarchiver</code> because I'm trying to save an array of custom objects with <code>NSUsersDefaults</code>. Because I kept on getting an error saying that I had non-properties in it I decided to archive them into <code>NSData</code>. Now I'm getting this error: "incomprehensible archive".</p>
  
  <p>Here is how I am archiving (I've tested all objects to be null, non of them are):</p>
  
  <pre><code>NSMutableArray *array = [[NSMutableArray alloc] initWithArray:anotherArray];
  for (int i = 0; i &lt; array.count; i++) {
      CustomObj *obj = [array objectAtIndex:i];
      NSData *newdata  = [NSKeyedArchiver archivedDataWithRootObject:obj];
      [array replaceObjectAtIndex:i withObject:newdata];
  }
  NSArray *newArray = [[NSArray alloc] initWithArray:array];
  [coder setObject:newArray forKey:@"key"];
  </code></pre>
  
  <p>Here is how I am unarchiving(again everything is tested for null):</p>
  
  <pre><code>if (!arrayM) { arrayM = [[NSMutableArray alloc] init]; NSLog(@"initialized"); }
  else {
      for (int i = 0; i &lt; arrayM.count; i++) {
          NSData *data = [arrayM objectAtIndex:i];
          --&gt; The exception happens here: CustomObj *obj  = [NSKeyedUnarchiver unarchiveObjectWithData:data];
          [arrayM replaceObjectAtIndex:i withObject:obj];
      }
  }
  </code></pre>