I have a need to update some data from a webservice via a background thread in an app I'm working on.
Normally I'd just do this via an NSOperationQueue
and a synchronous web request in the main() function of the NSOperation
.
However, for this specific data fetch, the app requires the use of OAuth
and the OAuthConsumer
library I am using performs the request to the webservice via an asynchronous request with delegate method callbacks for success/failure.
My issue is that those delegate callbacks done seem to get processes, because (as is my understanding) my operation process is destroyed/cleaned up when the end of the main()
function is reached and the operation is pop off the operation queue's stack.
Is this accurate?
If so, is there a solution to doing this via an NSOperationQueue and if not, what is the current best practice for grabbing data via a background thread in an asynchronous manner that can handle delegate callbacks?