How can communicate with each other a "helper app" and a GUI app?
I'm writing a Mac OS X application that shows the temperature history chart in a certain city. Temperatures are taken from a web service.
I would like to ensure that its internal database is updated once every hour, even if the application is not running.
There is a convenient way to do it?
I thought about the possibility of creating an "Helper application", i.e. an app that runs in the background thanks to the LSUIElement flag + a NSStatusBar. It seems that it's perfect for my case: it would appear in the right side of the Me开发者_开发问答nu Bar, but not in the Dock. This helper app will query, once per hour, the web service and will write the temperature and its timestamp in a database (with Core Data).
In addition to this "helper app" there would be the "report app", i.e. a normal application with a user interface that will display the temperature history chart based on the data stored in the database (with Core Data).
The problem, however, is that I do not know how can the two app communicate: they must use a single shared database? It is possible to do that with Core Data?
Core Data does not support simultaneous access to the same store from multiple applications.
If you don't mind not having a menu bar (how much UI do you need?), my recommendation would be to just make it all one application, with LSUIElement
set. You can open a window that the user can focus and interact with.
精彩评论