How to cache JSON data for offline reading in iPhone APP?

I'm new to iPhone development, and I still have some gaps that need to be filled in the first application I'm developing. This application will consume data from a Wordpress-driven site through the Wordpress JSON plugin, which allows you to retrieve messages as a json string.

I wanted my application to save messages in some form of caching, so users only had to download new content after the first time. Think of a Twitter app that saves all your previous downloaded tweets and only downloads new ones.

What is the best way to do this, should I save json as a file, or is there another efficient method to store it in cache?

+3
source share
1 answer

I am currently developing an application that will do such things. And I found many possible solutions.

If you still have problems with this, check here: http://cocoawithlove.com/2010/09/substituting-local-data-for-remote.html

If your application should be simple, this might be ideal.

Another way might be to subclass NSURLProtocol, but I'm still exploring this solution.

+1
source

Source: https://habr.com/ru/post/1770205/


All Articles