Not sure if the header is correct, however I am trying to use the standard NSURLConnection class to handle responses from my web service call. I use the POST method to update the database and the GET method to retrieve rows from the database. The problem is that these two actions can occur simultaneously, so the request processing methods can step on each other. In other words, in my "connection didReceiveData" method, I have 2 paths through the code, depending on whether I am processing the response from a GET or POST request.
I keep track of which request is being processed by an instance variable called requestType. The problem is that since the requests are executed at the same time, the instance variable changes from GET to POST until the GET completes (or vice versa). My question is: how can I support 2 separate queries in this scenario? Am I syncing requests? Is there a way for threads to work here? I create 2 separate objects for each of the requests and I have the logic in the request "didRecieveData", for which object is it being processed? Any help would be greatly appreciated!
source
share