i am on macOS, objective-c, not iOS. I am currently re-writing my app to be document based. I now save the reuired data in each NSDocument file as property which works great including autosave.
I can access that data from NSViewControllers by
self.view.window.document.mydata
I also can access the data by
[[NSDocumentController sharedDocumentController] currentDocument].mydata
But as documentation says to the method above
The value of this property is nil if it is called when the app is not active.
My issue is that i have (tons of) custom NSObjects in a document that handle stuff and need access to that data. This also happens in the background (with timers). What is the best way to reach the document from a NSObject if the app is in the background and no window is available?
Would i need to pass the document to each object on creation? This does not feel correct.