I need to compress a string into GZIP format. I've looked at Apple's compression framework documentation, but GZIP does not seem to be a supported algorithm.
My ultimate goal is to make a NSURLSessionData task with an urlRequest that has a GZIPPED postBody.
I know that the ZLIB algorithm is similar to GZIP, so is there some way to modify the results of ZLIB compression to get GZIP?
CodePudding user response:
gzip is not an option for that compression framework. You can use zlib directly to compress and decompress gzip streams. zlib is already installed in iOS. zlib.h is the zlib documentation. deflateInit2()
will allow you select the gzip format for compression.
A comment to your question points to some example code in Objective C.