Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local storage for iPhone app

I want to develop an application. The functionality is similar to RSS feed reader. Read a XML from web service and display them in a table view. But I have some problems to deal with the local storage. I do not need to store all the history records since it takes a lot of storage. But I do want to store dozens of newest records so the user can really see something even when the new data is loading or there is no network connection. What should I do? Should I use Coredata or other methods?

like image 975
Gang Wu Avatar asked Jul 17 '11 17:07

Gang Wu


People also ask

How do I put local storage on my iPhone?

Go to Settings > General > [Device] Storage. You might see a list of recommendations for optimizing your device's storage, followed by a list of installed apps and the amount of storage each one uses. Tap an app's name for more information about its storage. Cached data and temporary data might not be counted as usage.

Does localStorage work on iPhone?

localStorage works on desktop but not mobile (iOS version 12.2)

What is local storage in iOS?

Local storage is meant for retaining web app data locally using certain frameworks, tools and methods distinctive to different platforms. For iOS storage there are different methods to choose from. The choice, however, depends upon what and how much data you want to store.


1 Answers

There are several ways to implement this storage within your iOS project (3 that I will mention here):

  1. Core Data - Core Data is extremely powerful, and it could certainly handle your use case. There is some overhead in setting up your data model. You can read about Core Data here: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreData/index.html

  2. SQLite Database - Your core data implementation would probably use SQLite as its persistent store. However, you also can use SQLite directly. This allows you to handle the data however you want, but it also requires a lot of overhead to get it up and running in the manner you mentioned above. This can be a good solution but, I don't think it is a good fit for your project. http://www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPhone_Application

  3. Property List - Property lists are very easy to implement within a project for both reading and writing data. You can read more about property lists here: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html

Hope that helps.

like image 120
dtuckernet Avatar answered Sep 20 '22 16:09

dtuckernet