There are many different storage methods that you can use in an iOS application, there is not one best than the other, it depends on what data you are going to store. The most common situation is to end up having to use more than one method for the different persistence needs of your application (user settings, edited documents, data gathered from a web service, etc.) .
Now, let’s have a look on most widely used ones, when it comes to an iOS application:
- Plaintext, CSV
- Property Lists
- User Preferences
- Core Data
As you can see, the list is sorted from the lowest level to the highest level one. We do not encourage the use of the first two methods, they are very useful and common in other platforms, but because of the frameworks available in the iOS SDK, it is much easier to work with the other. What follows is a brief summary on them:
Property Lists (.plist)
Property List documents are an archived tree of objects. In fact, they are nothing but an XML file where you can archive NSData, NSNumber, NSString, NSDate, NSArray and NSDictionary classes.
SQLite is a C library, so it can be sometimes tricky to deal with (think of objective C object data types), but may be the perfect choice if you are developing your application for both, Android and iOS.
The Core Data framework is perhaps the most complex, but it is the method recommended by Apple for local storage of an application’s data.
User Defaults (NSUserDefaults)
Information stored in this method should be limited to user changeable settings and options. It is very important to do not use it for storing usernames and passwords. For storing sensible information it is better to use Keychain service available in the iOS.