A category on NSData that provides a simple way to gunzip gzipped data.
Using the category is very straight forward.
- Add libz.dylib to your project.
- Add NSData+IDZGunzip.m and NSData+IDZGunzip.h to your project.
- Then you do something like this:
#import "NSData+IDZGunzip.h"
...
// Assuming data holds valid gzipped data
NSError* error = nil;
// gunzip the data
NSData* gunzippedData = [data gunzip:&error];
if(!gunzippedData)
{
// Handle error
}
else
{
// Success use gunzippedData
}