문제

I'm thinking of making a Core Data-based document-centric application, but I want the saved file format to be my own proprietary bundle of XML, images and other stuff.

My plan is to use a subclass of NSPersistentDocument that serializes back and forth between my file format and Core Data when receiving calls like -writeToURL, -readFromURL, and so on.

Is this an anti-pattern? I've started experimenting with it and it seems like it would work, but I don't see much documentation/discussion about this approach, which gives me pause.

도움이 되었습니까?

해결책

Use a custom atomic store type. You only need to be a valid store type that handles what Core asks and everything else should "just work". Your custom store type can then act as the translation layer between Core Data and your own format.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top