views:

31

answers:

0

This is pretty weird and I would very much appreciate all help =)

I have a document based app where it should be possible to perform some actions on the document file. To do so I'm saving the document every time the document actions are called. To do so I'm using the method:

saveDocumentWithDelegate:didSaveSelector:contextInfo:

The problem is, that when closing the document, reopening it from the recent files menu and then performing the action again I'm being presented with the dialog box saying that

This document’s file has been changed by another application since you opened or saved it.

However this is not the case when using the save menu item.

I've tried with different save methods:

saveToURL:ofType:forSaveOperation:error:

And even though this results in the behavior I'm looking for there is a side effect: The save menu item becomes deactivated after performing the action.

So my question is: How should I correctly perform save operations programmatically? I've looked through the docs but I haven't seen anything which looks like an obvious solution.

All help is appreciated. Thanks