iphone - NSXMLParser initWithContentsOfURL timeout -
How can I set a timeout when I am parsing a feed using initWithContentsOfURL? Sometimes our feeds return an empty response and then it will only try to parse the feed forever. I want to integrate 30 seconds, so look at UAL-ul-view and then try to feed and re-insert. NSURL * feedURL = [[NSURL alloc] initWithString: URL]; NSXMLPers * Parser = [[NSX Parser Allok] Init with content of URL: feed URL]; [Parser set deliaget: self]; [Parser's sethold process namespace: no]; [Parser setshall reportnamePassprint: no]; [Parsets setSoldRSOLVXACATTTS: No]; [Parser pars]; The first method: A delayed selector Perhaps the easiest way to do this is to use the method of NSBox. You can define some method parsingDidTimeout as such: - (zero) parsingditetimeout {if (self.parsingDidComplete == NO) {[self.parser abortParsing]; // Create your error and display it here // Try to reload and parse it again ...}} For this, you should assign a parser to an instance variable ( Self.parser )...