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 (MyDocument). Now, it works perfectly !
Here is the code I now use : - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSOKButton) { NSError * error = nil; SBDocument * newDoc = [[[SBDocument alloc] init] autorelease]; NSManagedObjectContext * moc = [newDoc managedObjectContext]; [[moc persistentStoreCoordinator] addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[sheet URL] options:nil error:&error]; //[newDoc setFileType:@"ShoppingBagDocument"]; //[newDoc setFileURL:[sheet URL]]; //[newDoc saveDocument:nil]; [newDoc saveToURL:[sheet URL] ofType:@"MyDocument" forSaveOperation:NSSaveOperation error:&error]; } [sheet orderOut:self]; } I've replaced the three commented lines with the saveToURL... call which looks cleaner to me. But it also works with the three commented lines. Again, thanks a lot for your valuable help. I would have been stuck for a long time if you did not pointed me to the right direction. Kind regards, Eric. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com