Monday, May 28, 2012 [Tweets] [Favorites]

Core Data, Document-Based Application, and Sandboxing

Christian Kienle:

The save fails because the underlying SQLite library created temporary files on behalf of Core Data. You may have seen a file like this. Usually this file has the suffix “-journal”. When you activate sandboxing your application is only are allowed to read and write to the store file itself and not to the “-journal” file. This explains why the save of the context fails.

Sandboxing is incompatible with the default way of saving Core Data files. Developers filed bugs about this as soon as sandboxing was announced last June, but there has been no change. The workaround is to turn off database journaling, which puts your data at risk in the event of a crash or power failure.

5 Comments

It's pretty amusing. I brought this up on the forums back in November:
https://devforums.apple.com/message/619403#619403

The response to turning off the journal was "Please don't ever do this.", and to change my file format to a package. Which is just nuts.

"The workaround is to turn off database journaling, which puts your data at risk in the event of a crash or power failure."

Of course, the workaround for end-users is to just use Apple apps, which are free from all of the insanity since they don't have to be sandboxed.

After all, adults don't play in the sandbox. It's meant for kids.

[...] It’s strange how developers like Core Data, and have adopted it widely, yet Apple doesn’t seem to make much use of it in its apps and, perhaps for that reason, has not fully supported it in the frameworks and with new technologies such as sandboxing. [...]

[...] is like the more well-known issue with Core Data and SQLite journal files, except that the filename suffix isn’t predictable. Behind the scenes, Core Data tries to [...]

[…] It’s strange how developers like Core Data, and have adopted it widely, yet Apple doesn’t seem to make much use of it in its apps and, perhaps for that reason, has not fully supported it in the frameworks and with new technologies such as sandboxing. […]

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment