Core Data Bug in Leopard
What's the worst e-mail a software developer can receive? As of right now, it's "Help- Your software ate all of my data". As a teacher/developer, my goal is to save my users time. If your planbook file loses its data, I'm not saving you time and I'm probably making you miserable. Data integrity is my number one priority and this is why the data loss bug that several users reported on Leopard was so disconcerting to me.

Based on the e-mails I received, I just spent the last few days diagnosing and fixing a major problem that appeared in Planbook when run on Mac OS X Leopard. Essentially, Planbook files became zeroed (lost all of their data) when being saved. I spent time looking through my code to figure out what was going on but eventually came across this posting on the ADC-Cocoa list:

http://www.cocoabuilder.com/archive/message/cocoa/2007/11/2/192065

that detailed exactly the same problem I'd been experiencing.

It turns out that Apple's code is at fault. Any time a Core Data Document (Planbook uses Core Data to store lesson plan information) is saved and changes have not been made to the file, all of your data is instantly lost. Crazy. Press save and lose all your data. I've fixed the problem by overriding how document saving is done- checking to see if changes have been made to your document and disallowing saves if they haven't.

I'm posting this for two reasons. 1) Please, please back up your data. Especially when upgrading to a brand new .0 release of an operating system. 2) Other developers need to be aware of this issue. It's pretty simple to work around the problem- but if you don't, you'll have users who (like the teachers using Planbook) experience complete and total data loss