In iOS does either NSURL or NSXML span a new thread?

MOIVGSTER

New Member
I have a program that progresses as follows. I call a method called \[code\]getCharacteristics\[/code\]. This method connects to a remote server via a NSURL connection (all networking code done in another file) and when it receives a response it makes a method call back to the original class. This original class then parses the data (xml) and stores its contents as a map. The problem I'm having is that it appears that somewhere in this transaction another thread is being spawned off. Here is sample code showing what I'm doing:\[code\]@property map- (void) aMethod{ [[WebService getSingleton] callWebService: andReportBackTo: self] Print "Ready to Return" return map;}- (void) methodThatIsReportedBackToAfterWebServiceRecievesResponse{ //Parse data and store in map Print "Done Parsing"}\[/code\]The problem that I am running into is that map is being returned before it can be fully created. Additionally, "Ready to Return" is being printed before "Done parsing" which suggests to me that there are multiple threads at work. Am I right? If so, would a simple lock be the best way to make it work?
 
Back
Top