UIManagedDocument - managedObjectContext
UIManagedDocument 의 managedObjectContext 관련된 LibraryReference 에 기술되지 않은 추가 내용이 UIManageDocument.h 파일에 기술되어 있다.
UIManagedDocument 의 managedObjectContext 는 반드시 NSMainQueueConcurrencyType 으로 생성되어야 하며, parent context 를 가지는 경우 parent 는 NSPrivateQueueConcurrencyType 으로 생성되어야 한다.
즉, UIManagedDocument 의 ConcurrencyType 을 설정해서 간단하게 쓰레드를 분리하는 것은 어렵다. !!!
분리하려면, PrivateQueueConcurrencyType 으로 생성된 ParentContext 를 마스터로 하여 분리해내야 하는 것 같다.
자세하는 테스트 는 나중에 ....
아래는 관련 document 를 발췌한 것이다.
Library Reference
managedObjectContext
The document’s managed object context. (read-only)
Discussion
The document automatically creates a managed object context using its persistent store coordinator.
Special Considerations
You must not use the document’s managed object context in writeAdditionalContent:toURL:originalContentsURL:error:
, or any of the asynchronous UIDocument
methods.
Availability
- Available in iOS 5.0 and later.
Declared In
UIManagedDocument.h
...
UIManagedDocument.h
NS_CLASS_AVAILABLE_IOS(5_0) @interface UIManagedDocument : UIDocument {
...
}
/* Persistent documents always have a managed object context and a persistent store coordinator through that context. The managed object context is required to be initialized with the concurrency type NSMainQueueConcurrencyType and it must have a parent context initialized with the concurrency type NSPrivateQueueConcurrencyType.
*/
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;