Hi all, My document model is Core Data based. When a new document is created, I must initialize the model to contain several objects with default values.
I followed Apple's "Departments" example: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/04_Department/department.html#//apple_ref/doc/uid/TP40002832-SW1 At that page, it explains how to create a new Department object when a new document is created. It does so by implementing -(id)initWithType:error: in the MyDocument class, which is a NSPersistentDocument subclass, just like my own app's document class. However, initWithType:error is never called for new document creation (or any document creation for that matter). I placed a breakpoint inside the method and execution does not pause there. Instead, -(id)init gets called. This is a problem because -(id)init is called when documents are opened as well as created from scratch. My questions are: 1. Have I overlooked something? 2. Is there a better way to initialize new Core Data models to a known state? (Yes, I know I can create a whole model in code, a la the Core Data Utility example, but I mean when using NSPersistentDocument.) Thanks, Soong _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
