Error deserializing json stream
问题 I have an NSInputStream *inputStream receiving small JSON objects from a network connection. If I read the stream to a buffer like so: NSError *err = nil; uint8_t buffer[1024]; NSMutableData *data = [[NSMutableData alloc] init]; while ([inputStream hasBytesAvailable]) { int const len = [inputStream read:buffer maxLength:sizeof(buffer)]; if (0 < len) { [data appendBytes:buffer length:len]; } } NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&err]; then I get