Sunday, June 17, 2012

I just realized that the current Mac sandboxing situation makes a new major version of Core Data Editor impossible/not practical. A few weeks ago I published a blog post which describes an issue related to Core Data and sandboxing. Let me sum this post up really quickly: If you have a SQLite store it creates a temporary file during the save operation in order to be able to roll back in case something goes wrong. The sandbox mechanism cannot handle this at the moment and therefor the save operation fails. Basically there are two workarounds (as described in the linked blog post):

disable the creation of the journal file - this has bad side effects

wrap the SQLite store file in a folder

Core Data Editor is a tool for developers which allows them to inspect and edit the data in a store file so the workarounds are not possible. The first workaround is not possible because it would lead to inconsistent data and Core Data Editor would be hold responsible for this. Workaround number two is a good workaround for 99% of the developers but I am in the situation that I cannot do this because Core Data Editor is a generic application. You should be able to throw anything at it - not only SQLite files wrapped inside a folder. Core Data Editor is not the only application having this problem. Basically any SQLite editor out there has this problem. One prominent example is Base from Menial - a competitor of Core Data Editor when it comes to editing Core Data SQLite stores.

The problem is more widespread

In my opinion the problem is even more widespread: Every application that can edit files through a library that has to generate temporary files in locations not supported by the sandbox mechanism is out of luck. I really hope that Apple is considering this Core Data issue something they have to fix. But how do we expect them to fix this? The journal file causing the problem is not created by Apple directly. The underlying SQLite library used by Core Data is creating the temporary file. Do we want Apple to go through every third party library and adjust the sandboxing mechanism according to the implementation details of these libraries? I guess not but in my opinion the problem described above is special. Core Data is an integral part of Cocoa and Cocoa Touch. It is an awesome framework. I fell in love with Core Data when it first came out with 10.4 (Tiger). Hell - I am even writing a whole book about Core Data. It is heavily pushed by Apple. Core Data is supposed to make iCloud a piece of cake for developers. Apple - please make an exception so that Core Data Editor can receive major updates and to make life easier for the other developers not using bundle-based file formats.