Is there a compression API available for use on the iPhone? We’re building some RESTful web services for our iPhone app to talk to, but we want to compress at least some of the conversations for efficiency.
I don’t care what the format (ZIP, LHA, whatever) is, and it does not need to be secure.
Some respondents have pointed out that the server can compress its output, and the iPhone can consume that. The scenario we have is exactly the reverse. We’ll be POSTing compressed content to the web service. We’re not concerned with compression going the other way.
zlib and bzip2 are available. And you can always add others, as long as they’ll (generally) compile under OS X.
bzip2 is a better choice for smallest file sizes, but requires much more CPU power to compress and decompress.
Also, since you’re talking to a web service, you may not have to do much. NSURLRequest accepts gzip encoding transparently in server responses.