开发者

How to Cancel the parsing of xml that is in the another thread

开发者 https://www.devze.com 2023-03-26 10:06 出处:网络
i want to connect the webservice and parse the xml as it will take time to execute so i done it in a separate thread and show a activity indicator to the user now i also want to insert the cancel opti

i want to connect the webservice and parse the xml as it will take time to execute so i done it in a separate thread and show a activity indicator to the user now i also want to insert the cancel option.

Because if the network connection or parsing take long time and user want to abort the processing the user will be able to do this.

so my question is now how can i cancel a thread? the main problem is that the network connection is a separate class and xml parsing is another class and as both are sequentially executing the开发者_JS百科n how can i manage it.

how to cancel network connection or may be it's parsing then how can i abort the parsing and thread.

Thanks


NSURLConnection returns a connection handle and you can send the cancel message to that handle.

[connection cancel];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号