Use CoreData or SQLite on iPhone?
Since CoreData has become available for the iPhone in OS 3.0, is it meant to be the answer to data persistence and replace all need for direct
What reasons exist to still use
SQLite? What are advantages/disadvantages of
- iOS Rolling out app updates. Keeping user data intact when DB update required
- Using NSString/parameters into SQLite statement iOS
- How to access an FTS table in SQLite.swift using the IN condition
- Objective-C and sqlite's DATETIME type
- How do I add files to the resources folder in XCode?
- ORDER BY random() with seed in SQLITE
3 Solutions Collect From Internet About “Use CoreData or SQLite on iPhone?”
This is a common question here:
- “Core Data vs. SQLite for SQL experienced developers”
- “Core Data vs Sqlite and performance…”
- “Core Data vs sqlite3”
- “is it worth using core data for a simple sqlite app on the iphone with one table and no relationships or complicated subtable/views?”
In summary, Core Data can greatly simplify your code, particularly for complex object models. You get undo / redo support almost for free with it. It also provides some very significant performance benefits, particularly on the iPhone. Even though it seems counterintuitive, given how much overhead you’d think the framework has, in most cases you can beat the performance of hand-tuned SQLite using Core Data. On the iPhone, it does a great job of batching fetches to minimize memory usage.
The one downside, as pointed out, is that this limits you by requiring iPhone OS 3.0 for your end users. However, this has not been a problem at all for my users, and will only become less of one going forward.
This might be a lesser benefit, but SQLite is a lot more portable between platforms, since Core Data is part of Cocoa, and SQLite is pure C. This means that if you wanted to port your application to PC, for instance, you would have less code to rewrite in the event that you use pure SQLite.
Then if you wanted to develop anything else cross-platform using a local DB (not necessarily related to any iPhone apps), you would have already have some experience with SQLite.
If you want your application to run on iPhones not running OS 3.0, you will have to use SQLite.
However, using CoreData (which uses SQLite as a backend, I believe) means you don’t have to write your own database-interaction code which is quite a hassle to do, especially when you are doing relations etc.
I use CoreData myself…
- enum of structs in swift 3.0
- iPhone view move animation
- How to capitalize the first word of the sentence in Objective-C?
- Trying to get symbols for an iOS .crash file
- Objective-C HashMap equivalent
- Xcode iOS 8 Keyboard types not supported
- how to have 2 different setting page with inappSettings
- Swift – how to use malloc?
- SDWebImage/UIImageView+WebCache.h file not found
- How to load animated GIF from photo library
- How can i get next date using NSDate?
- Displaying two different cells in a collection view – Swift 2.0 iOS
- Taking Text From a UIAlertView
- How do you make a shake animation for a button using Swift 3
- Xcode 4 build setting variables for scheme scripts