user592419
user592419

Reputation: 5233

Do NSManagedObjects have file urls?

I have an NSManagedObject *obj written to an NSManagedObjectContext. It has key/values which include a "data" key that returns a ~5-10mb size NSData *value. How do i get the url / file path where value is stored?

Upvotes: 0

Views: 132

Answers (2)

Mike Abdullah
Mike Abdullah

Reputation: 15003

By default, Core Data stores everything into a flat persistent store file, usually SQLite. Thus there is no individual file on disk that holds the data you assign to an object.

You can turn on .allowsExternalBinaryDataStorage for individual attributes in your model if you wish. This allows Core Data to shove the data into a separate file on disk, if it sees fit.

It's important to note that this is for performance optimisation purposes. Core Data does not expose any API to tell you the URL of the file on disk.

Upvotes: 2

matt
matt

Reputation: 535325

There is no such file url. The way you've designed this managed object and its attributes, the data is stored inside the persistent store along with everything else.

Upvotes: 0

Related Questions