So the first question is how does dispatch_async
determines which thread to use? just picks it randomly? I need to do some parsing and core data stuff, so I don't want to block UI thread and use dispatch_async
, but after that I send a NSURLRequest
to fetch some more data and the callback is never invoked (probably because the thread is already dead).
So what's a good way of making it? And I can not use
sendAsynchronousRequest:queue:completionHandler:
because the deployment OS is 4. for now I just send request inside
dispatch_async(dispatch_get_main_queue(), ^{
});
which is inside dispatch_async(myQueue)
block which does all the parsing and saving to core data. But it does not seem right to me, I mean there should be a way to use dispatch_async and tell it not kill the tread, right? Because using sync requests is not an option.