Reputation: 11361
I have to download 100 thousand JSONS, each JSON not more than 200 characters. I am using AF networking. Is there a way to encode to reduce the size at the server side and send and i should be able to decode at iPhone side.
Moreover has anyone got a method to download the JSONS and store it in the DB on the background thread.Because when i do that directly the UI thread is blocked. Sample Code would be really helpful.
Need the best way to download the HUGE-JSON and store it in the DB.Thanks!
Upvotes: 0
Views: 161
Reputation: 76
For encoding you can, for example, use gzip-compressed data in your http response that will be unpacked by ios automatically without the need to code anything. Just add "Content-Encoding: gzip" to your http response on the server side. On iOS, i think NSURLRequest accepts gzip encoding by default, or you can set
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]
Of course you can download the JSONS in the background. A good source for information and example code is here http://iosdevelopmentjournal.com/blog/2013/01/27/running-network-requests-in-the-background/
Upvotes: 1