I have an NSOperation derived class which performs asynchronous download.
Because the download operation has to be initiated from the main thread, the response is also completed on the main thread.
Once the download has completed, I want to perform more heavy operations on the downloaded data within the NSOperation.
How do I get the operations after the download has completed to be performed in a background thread again within the existing NSOperation?
If you instead of moving to main thread in the NSOperation, rather start the connection in the current thread being run by your NSOperation.
Then, keep the NSURLConnection alive by adding a NSPort to the NSRunLoop.
Now all the callbacks will be received in the same thread as the one you started the connection in – and you may continue to perform your additional work here, which is already in the background.