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
I found solution for this problem in my case.
Problem was in options in overriding of configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:
method of NSPersistentDocument
. Problem was solved when I delete string
[options setObject:[NSNumber numberWithBool:YES] forKey:NSSQLiteManualVacuumOption]
I used vacuum option for some reason. Don't know how but it caused problem with saving. When I refused this option the problem has disappeared.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With