title: CoreBluetooth read NSData
body: <p>i try to read and write something in CoreBluetooth</p>
  
  <p>So my device(peripheral) send me the lenght of a array
  and the array as one.</p>
  
  <p>I read the value with this method</p>
  
  <pre><code>(void)readValueForCharacteristic:(CBCharacteristic *)characteristic; 
  </code></pre>
  
  <p>when i get the answer from the peripheral the </p>
  
  <pre><code>(void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
  </code></pre>
  
  <p>is calling
  When i read one value it is not a problem</p>
  
  <pre><code>char arrayLength;
  </code></pre>
  
  <p><code>charakteristik.value getBytes:&amp;arrayLength lenght:SERVICE_ARRAYLENGTH_LEN]</code></p>
  
  <p><code>self.MyArrayLenght=(float)arrayLength;</code>-</p>
  
  <p>But when i get the array from the Peripheral i dont know how to read them</p>
  
  <p>charakteristik.value is NSData</p>
  
  <p>when i trying to</p>
  
  <pre><code>NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:charakteristik.value]
  </code></pre>
  
  <p>i got error </p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)'
  </code></pre>
  
  <p>The hex (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69.......) are the data what i want to read and later show </p>
  
  <p>How can i read the NSData? Or How i can convert the NSData to NSArray?</p>
  
  <p>Edit:
  Problem solved</p>