Updating via App Store while the app is running wipes out the current document

I have a document-based app that's available on the App Store. When the user updates the app while it's still open, any files that are being worked on get wiped clean (meaning the original files on the hard drive), with the string (null) written into them.

The app does not force anything to be saved on closing, I'm not using autosavesInPlace and nothing should return null as file contents. There should be no reason for the App Store to cause this behavior.

I've experienced similar oddities with other apps when downloading an update while the app is still running, but I really would like to find out why and where this happens. Does App Store suppose the app is using autosavesInPlace, and try to force it to save the document before relaunching, or what is going on?

I've read through the docs to find any methods to catch these situations, but there seem to be none. It's also a quite hard one to debug.

Is there a way to reproduce a somehow similar situation, in which the app gets updated via App Store while still running?

Updating via App Store while the app is running wipes out the current document
 
 
Q