I have a web service, which I’m using to upload images to a server. I consume the service inside an NSOperation. When I call the methods of service synchronously, everything is ok, but when I call the methods asynchronously, the web server never receives the request. The only reason I can think of this happening is that thread was killed even though inside the web service asynchronous call there is loop which keeps the current runloop active until a response is received.
I have a web service, which I’m using to upload images to a server.
Share
Looking at the documentation for
NSOperation, you will see how to implement concurrentNSOperations. In short, instead of implementingmain, you implementstart,isConcurrent,isExecuting, andisFinished. So typically you would returnYESforisConcurrent, start your request in thestartmethod and setisExecutingto YES, and when your request finishes setisFinishedto YES. For much more details please see the official Apple NSOperation class documents.