Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-30 Thread Kevin Perry
On Sep 29, 2011, at 4:41 PM, Kyle Sluder wrote: [...snip...] A general issue I have with asynchronous saving: what if the save operation fails? The user has now made additional changes, but their Save a Version operation did not create a version for them. So now they can't roll back to

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-30 Thread Kevin Perry
On Sep 30, 2011, at 8:47 AM, Kevin Perry wrote: On Sep 29, 2011, at 4:41 PM, Kyle Sluder wrote: [...snip...] A general issue I have with asynchronous saving: what if the save operation fails? The user has now made additional changes, but their Save a Version operation did not create a

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kyle Sluder
On Wed, Sep 28, 2011 at 10:55 PM, Kyle Sluder kyle.slu...@gmail.com wrote: I'd really appreciate if the documentation spelled out exactly how NSDocument uses these methods. To give an example of a specific NSDocument usage that I'd like to know about: how does asynchronous saving use

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kevin Perry
The header documentation for -performSynchronousFileAccessUsingBlock: (which also applies to performAsynchronousFileAccessUsingBlock:) says: this method's primary use is to wait for asynchronous saving, but in contrast with that method it is only for use to wait for the part of an

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kyle Sluder
On Thu, Sep 29, 2011 at 9:20 AM, Kevin Perry kpe...@apple.com wrote: If it were to call the fileAccessCompletionHandler any earlier then it might be possible, for example, for -fileModificationDate to be invoked on the main thread after -writeSafelyToURL: has written the file, but before the

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kevin Perry
On Sep 29, 2011, at 12:00 PM, Kyle Sluder wrote: On Thu, Sep 29, 2011 at 9:20 AM, Kevin Perry kpe...@apple.com wrote: If it were to call the fileAccessCompletionHandler any earlier then it might be possible, for example, for -fileModificationDate to be invoked on the main thread after

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kyle Sluder
On Thu, Sep 29, 2011 at 12:33 PM, Kevin Perry kpe...@apple.com wrote: On Sep 29, 2011, at 12:00 PM, Kyle Sluder wrote: On Thu, Sep 29, 2011 at 9:20 AM, Kevin Perry kpe...@apple.com wrote: If it were to call the fileAccessCompletionHandler any earlier then it might be possible, for example,

Re: NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-29 Thread Kyle Sluder
Of course I have another question. On Thu, Sep 29, 2011 at 12:33 PM, Kevin Perry kpe...@apple.com wrote: NSDocument's NSFilePresenter methods use performAsynchronousFileAccessUsingBlock: internally, so if something else current has file access, the NSFileCoordinator requests are indeed

NSDocument Serialization (-performSynchronousFileAccessUsingBlock: and friends)

2011-09-28 Thread Kyle Sluder
I'm working on a document-based application, and am a bit befuddled by -performSynchronousFileAccessUsingBlock:. The documentation says that NSDocument itself consistently uses this mechanism around invocations of the following methods: and lists methods including -fileType, -fileURL, etc. The