movq

Wherein I Move A Lot of Words Around

Core Data

On Useful Error Messages

CoreData: error: (522) I/O error for database at /var/mobile/Containers/Data/Application/012CEF58-D497-451E-9256-CDD266930AF4/Library/Application Support/APPNAME/APPNAME. SQLite error code:522, 'not an error'

My favorite kind of errors are errors that aren’t errors but fail like errors because they’re really errors that don’t know they’re errors.

Core Data and Data Protection

A project I’m working on needed to secure the Core Data database on-disk in iOS (the nature of the content demanded it). When asked about this I instinctively said, “Sure! iOS has data protection APIs that easily allow that!”

I should stop answering so quickly.

Yes, there are APIs for that. The ones you’ll find mentioned all around the Internet are the additions to NSData and NSFileManager that let you use the NSFileProtectionKey attribute and set the protection class of the file and — MAGIC! — the file is encrypted and the keys are managed for you. The very first thing I did, then, was to naively write: