title: MonoTouch NSKeyedUnarchiver
body: <p>looking for help with NSKeyedUnarchiver  in Monotouch</p>
  
  <p>Storying an Array of Dictionary items in an SQLite blob field</p>
  
  <p><strong>IOS Code</strong></p>
  
  <pre><code>NSData     *data = [[NSData alloc] initWithBytes:ptr length:size];
  NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
  NSMutableArray *myArray = [unarchiver decodeObjectForKey:@"pricing"];
  [unarchiver finishDecoding];
  NSMutableArray *MutData = [[NSMutableArray alloc] init];
  for (NSDictionary *obj in myArray) {
       NSMutableDictionary *element = [[NSMutableDictionary alloc] initWithDictionary:obj];
       [MutData addObject:element];
  }
  </code></pre>
  
  <p>Trying to convert to MonoTouch,  so far I have</p>
  
  <p><strong>MonoTouch Code</strong></p>
  
  <pre><code>NSData data = NSData.FromString(item.pricing);
  
  NSKeyedUnarchiver unarchive =  new NSKeyedUnarchiver(data);
  unarchive.DecodeObject();
  unarchive.FinishDecoding();
  
  NSMutableArray array = unarchive.GetNativeField("pricing") as NSMutableArray;
  NSMutableArray mutArray = new NSMutableArray();
  
  for (uint count=0; count &lt; array.Count; count++)
  {
      NSMutableDictionary mutDict = new NSMutableDictionary(array.ValueAt(count));
      mutArray.Add(mutDict);
  }
  </code></pre>
  
  <p>Produces and Error at runtime</p>
  
  <blockquote>
    <p>Unhandled managed exception: Objective-C exception thrown.  Name:
    NSInvalidArgumentException Reason: <em>*</em> -[NSKeyedUnarchiver
    initForReadingWithData:]: incomprehensible archive (0x62, 0x70, 0x6c,
    0x69, 0x73, 0x74, 0x30, 0x30)
    (MonoTouch.Foundation.MonoTouchException)   at (wrapper
    managed-to-native)
    MonoTouch.ObjCRuntime.Messaging:monotouch_IntPtr_objc_msgSend_IntPtr
    (intptr,intptr,intptr)   at
    MonoTouch.Foundation.NSKeyedUnarchiver..ctor
    (MonoTouch.Foundation.NSData data) [0x00027] in
    /Developer/MonoTouch/Source/monotouch/src/Foundation/NSKeyedUnarchiver.g.cs:88
    Stacktrace:</p>
  </blockquote>
  
  <p>From the new NSKeyedUnarchiver(data) line</p>
  
  <p>One  can someone suggest tutorials / examples for MonoTouch NSKeyedUnarchiver ?</p>
  
  <p>Two  can someone help with this error ?</p>
  
  <p>Last Is this the best way in light that the project is to be cross platform and work under Android (eventually)</p>
  
  <p>Thanks in advance</p>