Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Luke Hiesterman
You want to override contentsForType:. That is the main thread hook. This is discussed in http://developer.apple.com/library/ios/DOCUMENTATION/DataManagement/Conceptual/DocumentBasedAppPGiOS/Introduction/Introduction.html Luke On May 27, 2012, at 4:15 PM, "Manfred Schwind" mailto:li...@mani.de

Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Manfred Schwind
Interesting. When exactly should the copy be made? When subclassing UIDocument the usual methods (writeContents:... or similar) are already called on the separate thread. Can I dispatch making the copy on the main thread with dispatch_sync(dispatch_get_main_queue(), ...) ? Is that anywhere discu

Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Luke Hiesterman
Yes, in the simple case, you as the client only implement contentsForType: and loadFromContents:error:, which are both main thread hooks and you never need to worry about threading. You, the original poster, are correct in your observation that there is no support for a synchronous saving model

Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Mike Abdullah
The general idea is that you make some kind of copy of your model's state and pass that as the document's "content", leaving the background free to write it at its leisure. On 27 May 2012, at 21:35, Manfred Schwind wrote: > Hi, > > when using UIDocument, reading and writing the document is don

UIDocument and non-thread-safe Model

2012-05-27 Thread Manfred Schwind
Hi, when using UIDocument, reading and writing the document is done asynchronously in a separate thread. But there's one thing I don't understand: how is that supposed to be used with non-thread-safe models? In my opinion most straight-forward implemented models are _not_ thread-safe. If you ha