When you create your Modal Window pass it the documents managedObjectContext
to use.
So maybe have a property in the controller class for the modal window and set that modalWindow.moc=self.managedObjectContext
prior to calling modalWindow.show
or whatever you are using. Assuming self
is your NSPersistentDocument subclass.
You must used the documents existing MOC, don't create a new one (you can but you don't want to go there).
The documents MOC is your definitive access point for adding objects to your Core Data store.