I am working on an application that uses basic data, and I know that this is not thread safe, but trying to figure out how to properly manage it. Let me explain what I still have ...
I created a singleton that initiates a managed object and then is accessible to all other classes, it works correctly, since the same address of a managed object is accepted by all classes.
Then I have two classes that execute in this order ...
- Download data. This gets a record counter, and if the kernel database is zero loaded.
- Tableview, which then displays the data stored in step 1.
My problem is that step 1. Always returns zero records and step 2. Works and returns the correct number of records.
Having done some testing of the problem with 1. This is because the thread works, if I send a request in the same thread that the managed object was created on it, it works fine.
So why is this in class 1. I have to make sure the request is in the correct stream, but in class 2. It just works, or is it just luck. Is there a recommended and documented approach to streams and master data?
thanks
source share