Re: Compress/decompress NSStrings or NSData
Re: Compress/decompress NSStrings or NSData
- Subject: Re: Compress/decompress NSStrings or NSData
- From: Kyle Sluder <email@hidden>
- Date: Wed, 8 Sep 2010 20:53:37 -0700
On Sep 8, 2010, at 2:28 AM, "Rufat A. Abdullayev" <email@hidden> wrote:
> Hello All
>
> Sorry if that topic already is in the list. I just could not find it
>
> I need simple solution for compressing/decompressing NSData or NSString using only standard tools and libs
>
> I'm planning to compress JSON data on web server side and decompress it on iphone side
There isn't going to be a drop-in solution to your problem. The pieces are already there, but depending on your architecture you will need to connect them differently.
First I'd ask if you can use Content-Encoding: gzip on your HTTP connection. If so, NSURLDownload will take care of decompressing the data for you, and you need only worry about compressing the connection on the server side.
If you can't do this for some strange reason, or if the data you need to decompress is contained within your JSON data structure, zlib is included in iOS and you can use it to decompress your data.
Either way, when working with data, it is important to use NSData, *not* NSString.
Hopefully you are prepared to answer your own architectural questions and now have the pieces to implement your solution.
--Kyle Sluder_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden