How to save documents in a separate thread [Was: File changed by other application after saving]
How to save documents in a separate thread [Was: File changed by other application after saving]
- Subject: How to save documents in a separate thread [Was: File changed by other application after saving]
- From: Antonio Nunes <email@hidden>
- Date: Wed, 19 Dec 2007 05:59:25 +0000
On Dec 18, 2007, at 12:49 PM, Antonio Nunes wrote:
The saving is done by
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo
: which detaches a drawingThread to save the file, since saving
tends to be a rather expensive process. The saving routine does the
following:
-It checks if the directory already exists at the specified saving
path. If not it creates it. So within the domain of the issue a
directory is create here.
-It saves whatever it needs to save (or update) within the save
directory.
-If the document's fileURL is nil or not equal to the save path it
sets the fileURL to the new path.
-It sets the document's change count to NSChangeCleared.
I now discovered what causes the "file changed by other application"
alert to come up: it's the 3rd step listed bove. Setting the file URL
after saving. However: if I don't do that then my document remains
untitled, and won't point to the newly saved file.
Perhaps I better restate the question:
I need to save documents separately from the main thread so as to keep
the UI responsive. What is the correct/recommended way to go about that?
-António
-----------------------------------------------------------
Don't believe everything you think
-----------------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden