title: iOS zip with gzipDeflate
body: <p>I'm using the NSData+compression.h and the Base64Transcoder.h elements to be able to zip and unzip content.</p>
  
  <p>Basically to unzip the server responses.</p>
  
  <p>The unzip method works perfectly</p>
  
  <pre><code>+ (NSString *) unzip: (NSString*) stringValue{
      Byte inputData[[stringValue lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
      [[stringValue dataUsingEncoding:NSUTF8StringEncoding] getBytes:inputData];
      size_t inputDataSize = (size_t)[stringValue length];
      size_t outputDataSize = EstimateBas64DecodedDataSize(inputDataSize);
      Byte outputData[outputDataSize];//prepare a Byte[] for the decoded data
      Base64DecodeData(inputData, inputDataSize, outputData, &amp;outputDataSize);
      NSData *theData = [[NSData alloc] initWithBytes:outputData length:outputDataSize];
  
      //And now we gunzip:
      NSData* result = [theData gzipInflate];//make bigger==gunzip
  
      NSString *temp = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];
  
      return temp;
  }
  </code></pre>
  
  <p>But when I try to zip a content, using the simetric way, the gzipDeflate fails, and return an empty or nil value.</p>
  
  <p>This is my zip code</p>
  
  <pre><code>+ (NSData *) zip:(NSData *) theSourceData {
      // And now we zip:
      NSData *result = [theSourceData gzipDeflate];
  
      Byte inputData[[result length]];
      [result getBytes:inputData];
      size_t inputDataSize = (size_t)[result length];
      size_t outputDataSize = EstimateBas64DecodedDataSize(inputDataSize);
      char outputData[outputDataSize];//prepare a Byte[] for the decoded data
      Base64EncodeData(inputData, inputDataSize, outputData, &amp;outputDataSize, NO);
  
      NSData *theData = [[NSData alloc] initWithBytes:outputData length:outputDataSize];
  
      return theData;
  }
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>Thanks</p>