title: Getting "JPEGDecompressSurface : Picture decode failed:" on creating UIImage from JPG raw data on iOS 10
body: <p>Since update to iOS 10, I'm getting the following error when creating UIImage from NSMutableData:</p>
  
  <blockquote>
    <p>JPEGDecompressSurface  : Picture decode failed:e000....."</p>
  </blockquote>
  
  <p>There is no strange or not normal behaviour resulting, but when I debug my application I see the error quite each time I create the Image.</p>
  
  <p>Here is the code, where I create the image from downloaded data using <code>GCDAsynchSocket</code> class:</p>
  
  <pre><code>NSData *imgDataToGen = [NSData dataWithData:imgBuffer];
  UIImage *img = [[UIImage alloc] initWithData:imgDataToGen];
  [_delegate client:self didReceiveImage:img];
  </code></pre>
  
  <p>The buffer <code>imgBuffer</code> is a <code>NSMutableData-Object</code>, which holds the downloaded image data. When the download is complete the data is converted into a picture and passed to the main GUI by firing the custom delegate method. In the main GUI then the image is set in image View.
  Once an image is processed, the buffer is cleared.</p>
  
  <p>I tried different things, like forcing the decoding of the UIImage already in background thread, but I get always same error. The image is rendered always in right way, so I  really don't understand the error message. </p>
  
  <p>I tried on <code>iPhone 5c</code> with <code>iOS 10.0.2</code> and on <code>Simulator 5s</code> with <code>iOS 9.2</code> and <code>10.0.2</code>. </p>
  
  <p>On <code>iPhone 5c</code> I get the error, on simulator not.</p>
  
  <p>How can I fix this error, or can this type of error be ignored?</p>