I have a document-based Mac app that uses a storyboard. To store per-document settings, I use the metadata for the document's persistent store. I wrote a function to retrieve the metadata. The problem I am having is where to add the call to retrieve the metadata.
If I add the call in the NSPersistentDocument subclass's init method, the persistent store coordinator hasn't loaded yet. The coordinator's array of stores is empty at this point, preventing me from accessing the metadata. If I add the call to the NSPersistentDocument subclass's windowControllerDidLoadNib method, the function doesn't get called. I set a breakpoint that is never hit.
Where do I place the call to my function to retrieve the metadata so I can access the persistent store and its metadata?