Closed no-itsbackpack closed 9 years ago
So I don't know how fetch request blocks work in RestKit. It's possible that gets run on a background thread; that would certainly explain why it can't find a context. I'm not quite sure what you ultimately do with fetch_request
but doing that on the main thread could be the right thing. You might also need to make a child context and work with that.
I will try running it on the main queue and let you know how it goes
Running on the main queue solved the issue
So this is more of a question than an issue. I am currently using cdq with RestKit to fetch and store data, everything works as it should until I try to
delete orphaned objects
by passing RestKit a fetch_request_block.rest_setup.rb
Running this code crashes when trying to access
Feed.first
with an error message that says cdq has not been initialized and that no contexts have been pushed onto the stack so please try runningcdq.setup!
even though I have clearly setup thestore
above.so I then added the following line
but this does not work all the time, it clears the objects when the controller is initially loaded but fails to delete anything on subsequent attempts. My guess is that I am trying to access/change the entity on a different thread, I also don't want to push a different context onto the stack every time I want to delete orphaned posts. This leads to my question:
Feed#fetch_request
on the main queue? Any sort of help is appreciated