Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to store the Core Data file?

The default Core Data for iOS template stores data in an .sqlite file in the NSDocumentDirectory. The file is therefor visible if the iDevice is connected to iTunes and file sharing is enabled.

I would like to change the directory to something that is not visible to the user and I would choose the NSApplicationSupportDirectory. Is this the correct directory? What do other developers use?

like image 268
fabian789 Avatar asked Dec 24 '10 10:12

fabian789


People also ask

What is Core Data file?

Core Data is an object graph and persistence framework provided by Apple in the macOS and iOS operating systems. It was introduced in Mac OS X 10.4 Tiger and iOS with iPhone SDK 3.0. It allows data organized by the relational entity–attribute model to be serialized into XML, binary, or SQLite stores.

How does Core Data save Data?

Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

Is Core Data a database?

Core Data is not a database. Core Data is a framework for managing an object graph. An object graph is nothing more than a collection of interconnected objects. The framework excels at managing complex object graphs.


1 Answers

The best place (on the iPhone) is the Library folder, as described here:

How can I get a writable path on the iPhone?

That directory is meant for things like databases that you do not want the user to be able to see through sharing.

like image 87
Kendall Helmstetter Gelner Avatar answered Nov 11 '22 11:11

Kendall Helmstetter Gelner