title: How to Retrive and Store NSArray from sqlite DB in iOS
body: <p>I have an array itemQtyArray which i am storing in SQLITE table As:</p>
  
  <pre><code>    NSData *toData = [NSKeyedArchiver archivedDataWithRootObject:self.itemQtyArray];
  
      NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO ORDERTABLE(ITEMDESC,ITEMQTY)VALUES( \"%@\",\"%@\");",dataString2,toData];
  </code></pre>
  
  <p>and then i am retrieving as :</p>
  
  <pre><code>    const void *itemQty = sqlite3_column_text(statement, 2);
      NSInteger qtyBytes = sqlite3_column_bytes(statement, 2);
      NSData *data2 = [NSData dataWithBytes:itemQty length:qtyBytes];
      NSArray *myArrayFromDB = [[NSArray alloc]init];
      myArrayFromDB = [NSKeyedUnarchiver unarchiveObjectWithData:data2];
      [self.itemQtyArray addObjectsFromArray:myArrayFromDB];
  </code></pre>
  
  <p>BUt i am getting Exception  at line</p>
  
  <pre><code>    myArrayFromDB = [NSKeyedUnarchiver unarchiveObjectWithData:data2];
  </code></pre>
  
  <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: </p>
  
  <pre><code>    '-[__NSCFData objectForKey:]: unrecognized selector sent to instance
  </code></pre>
  
  <p>Please tell what is wrong</p>