ios - Transformable images stored in CoreData - will it work with pre-seeded database? -
if use "transformable" attribute in core data store images, understanding core data may or may not store in persistent store based on file size. wouldn't care stored image, app need ship pre-seeded database in case internet connection not found when app first launched. want take snapshot (including images) of database , have load first time app launched.
my question is, if core data decides whatever reason not use persistent store, images still loaded when load pre-seeded database? or broken because image(s) stored in magic area no longer exists when user installs on own device?
making attribute transformable has nothing using external storage. store in external record file option available both binary attributes , transformables, not required either.
if have attribute transformable and uses external record files, you're correct core data decides whether use external file based on own undocumented logic (but checking size). external files saved in subdirectory of 1 data store located. if data store named foo.sqlite
, in same directory file found directory named .foo_support/_external_data/
. can deal in couple of ways:
- copy entire directory
foo.sqlite
lives, including dot files. preferred, because path external references directory undocumented , (in theory) change. you'll external references don't need hard-code directory name. - copy directory directly, since know is. less idea, reasons described above.
or if prefer, don't use external references. they're not required attribute, , if can have of data in monolithic sqlite file.
Comments
Post a Comment