I fixed the SwiftoDo chrasher that I griped about this afternoon, and, to future-me’s chagrin, I stayed up late to do it.
Tracking down the problem was tricky, but I eventually discovered that
revert method was failing because sometimes it was being executed on a closed file. It turns out that I was not interrogating
UIDocument.documentState correctly when checking for “closed” file state. The
documentState property is an OptionSet, and has a
contains method that is more appropriate to use than
== for this purpose.
At least, that what I think right now. I’ll test my app out for a day or two and see if the nasty crash bug rears its head again, or moves to a new call site.