Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core Data: "Store in External Record File" vs "Allows External Storage"

Tags:

core-data

I actually have a few questions related to Core Data entity attribute settings on iOS:

  1. Is "Store in External Record File" for Spotlight integration only?
  2. Is "Store in External Record File" for Mac OS only?
  3. On the iOS Simulator, where exactly are "External Record Files" stored?

These questions are not to be confused with the Binary Data attribute setting "Allows External Storage". I understand that setting will put data >1MB outside the store.

  1. On the iOS Simulator, where are "Allows External Storage" stored?

Thanks in advance for your assistance!

like image 750
Timbo Avatar asked Oct 26 '12 16:10

Timbo


1 Answers

This is described (in detail) in the Configuring the Model section of Core Data Spotlight Integration Programming Guide:

To enable Spotlight indexing, you need to specify which properties of which entities should be indexed and which—if any—of those properties should be added to the external record.

In Configuration inspector, for each of the properties that you want to be indexed, select:

Index in Spotlight (Optional) Store in external record file Provided that at least one property for an entity has the “Index in Spotlight” flag set, then whenever a change to an instance of that entity is committed to the persistent store, the corresponding external record file is updated (minimally the last modification date changed). This means that the Spotlight importer will run and so the Spotlight index will be updated with new data.

If you only choose “Index in Spotlight,” Core Data just creates a zero-length file for the corresponding record. If you also select “Store in External Record”, the property is added to the contents of the external record. Simple types, such as strings, dates, and numbers, are exported directly; relationships are stored as UUIDs.

AFAICT:

  1. Yes
  2. Yes
  3. Doesn't really apply
like image 146
Daniel Eggert Avatar answered Oct 26 '22 12:10

Daniel Eggert