Re: Create and save a NSPersistentDocument from scratch

2009-11-11 Thread Eric Morand
Thanks Quincey, Your code pointed me in the right direction : I needed to create a persistent store (of type NSSQLiteStoreStype) like in your example and add it to the newly created document context. I also replaced the file type "SQLite" with the correct file type defined in my plist (MyDocume

Re: Create and save a NSPersistentDocument from scratch

2009-11-11 Thread Quincey Morris
On Nov 11, 2009, at 10:15, Eric Morand wrote: I don't want my user to work with a non-saved document. Ever. For a good reason : since you need a saved document to use the mergeChangesFromContextDidSaveNotification method from NSManagedObjectContext, I don't have other choice than have my us

Re: Create and save a NSPersistentDocument from scratch

2009-11-11 Thread Eric Morand
> Next, this is a non-standard -- and incorrect-looking -- way to create a > NSPersistentDocument. Is there a reason you're not using a > NSDocumentController method (such as 'openUntitledDocumentAndDisplay:error:') > to create it? I don't want my user to work with a non-saved document. Ever. F

Re: Create and save a NSPersistentDocument from scratch

2009-11-11 Thread Quincey Morris
On Nov 11, 2009, at 04:34, Eric Morand wrote: - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int) returnCode contextInfo:(void *)contextInfo { if (returnCode == NSOKButton) { NSPersistentDocument * newDoc = [[[NSPersistentDocument alloc] init] autorelease];