_EXTERNAL_DATA folder not handled correctly

Hi!


I have a model with an antity that have a property that use the "Allows External Storage" option. For some reason the framework does not handle the files inside this directory correctly when some of the files have the SAME data.


Basically the issue is:


- You have an entity with a binary property that use the “Allows External Storage” option.

- You create some entities and for every entities you put the same data in the binary property.

- After saving Core Data will create inside the _EXTERNAL_DATA folder a file for every entity data.

- You delete all the entities from the store.

- Core Data will delete only a single file and all the other files are left in the directory forever.


So if you create for example 10 identical entities (same data) with 1MB of data for every entity, after deleting all the entities from the store your _EXTERNAL_DATA folder will still contain 9MB of orphaned data that will stay there forever. 😟


This bug is present in iOS 7, iOS 8 and iOS 9 beta 5.


I have made a sample project that illustrate this behavior:

http://www.dale1.ch/documents/delete_external_data_sample_project.zip


I have filled a bug report (18319761) the 12 September 2014 with all the informations needed to reproduce the issue but unfortunally is still Open and I didn't received any feedback from Apple.


Alan

Replies

Same issue here. Apple? Defeats the purpose of using this feature instead of handling file storage ourselves like we used to.

Core Data team... any answer?

I'm having this same problem. This behavior is very counterintuitive and can lead to filling up the disk. How can we ensure that externally stored data is deleted along with the record?