• 0

[Objective-C] Storing large amounts of data using Core Data?


Question

I am building an application (for iPhone, using Objective-C) which asks users a series of questions. I'm not sure how I should store the data. For privacy reasons, I think having a local database (not stored in the cloud) is ideal.

Core Data seems to be very easy to use, but I'm wondering whether it is suitable for storing large amounts of text (the questionaire has hundreds of questions, and each response would be a variable-length string, but the answers could potentially be long). Is Core Data a suitable way to store this data? Or should I investigate something else like SQLite?

4 answers to this question

Recommended Posts

  • 0

SQLLite is what you want to do but keep in mind that SQLite data on your app will be removed once the app is uninstalled but so will any other physical files you installed/generated so it's kind of a wash.

SQLLite is fairly simple and probably the best way for you.. read through this

http://klanguedoc.hu...tive-C-C-How-To

However, Core Data is more then just keeping records.. while SQLLite might be better for searching and retrieving data without tying up your memory footprint, Core Data will provide you with far more flexibility when it comes to managing connection between objects and the chain of events/states between those objects you can attach arbitrary code to handle which is something that database (SQLite) doesn't do.

Most often, Core Data will hold most of the data persistent in memory although it's not mandatory. It is recommended to use Core Data for keeping track of application states, relationship between objects but use SQLite when you need data to be persistent but not in memory and requires simpler search, retrieve functionality.

Also, some things Core Data won't do when compared to SQLite:

1. Core Data cannot operate on data without loading the data into memory

2. Core Data does not handle data logic (data-related features SQL contains, such as unique index keys)

3. Core Data does not offer any amount of threading support. Granted SQLite is single threaded too but there will be scenarios where you will want multiple threads reading your data. NSManagedObjects and their NSManagedObjectContext operate on a single thread only (or should be). If you want another thread dealing with the same dataset, you need to save the data from memory and then reopen with a different NSManagedObjectContext on another thread which creates latency and is not ideal.

Btw, this is a great chart that explains when and why you should use Core Data vs SQLite (database)

2012-02-03_110838.png

  • 0
  On 04/02/2012 at 14:23, iKenndac said:

Core Data can easily handle the amount of information you want to throw at it.

Excellent. :D
This topic is now closed to further replies.
  • Posts

    • Windows 12 perhaps would have codename Midnight of the company profits 😂 This system and it's update program gets more ridiculous with every new version
    • yet there are still dumb people decisions which takes the bait and go just where Microsoft guides them. left right left right just as a water particle in a microwave
    • Free Download Manager 6.29.0.6379 by Razvan Serea Free Download Manager is a powerful, easy-to-use and absolutely free download accelerator and manager. FDM accelerates downloads by splitting files into sections and then downloading them simultaneously. As a result download speed increases up to 600%, or even more! FDM can also resume broken downloads so you needn`t start downloading from the beginning after casual interruption. FDM lets you download files and whole web sites from any remote server via HTTP, HTTPS and FTP. You can also download files using BitTorrent protocol. In addition, Free Download Manager allows you to: adjust traffic usage; to organize and schedule downloads; download video from video sites; download whole web sites with HTML Spider; operate the program remotely, via the internet, and more! Free Download Manager is compatible with the most popular browsers Google Chrome, Firefox, Microsoft Edge, Internet Explorer and Safari. Free Download Manager 6.29.0.6379 changelog: Improved new desktop UI style. Improved add-ons support. Libtorrent updated to 2.0.11. Fixed: various bugs (including ones in the classic UI style). Download: Free Download Manager (64-bit) | 45.8 MB (Freeware) Links: Home Page | Linux, Mac, Android | MS Store | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Would like nice for a Steam Deck, but I don't think I would like this on a PC.
    • Zen Browser 1.14.7b is out.
  • Recent Achievements

    • Week One Done
      hhgygy earned a badge
      Week One Done
    • One Month Later
      hhgygy earned a badge
      One Month Later
    • One Year In
      NIKI77 earned a badge
      One Year In
    • Week One Done
      artistro08 earned a badge
      Week One Done
    • Dedicated
      Balaji Kumar earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      636
    2. 2
      ATLien_0
      237
    3. 3
      Xenon
      166
    4. 4
      neufuse
      143
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!