tags:

views:

124

answers:

1

Hello,

My application has buttons in a Tab bar.

When I touch a button I load a nib, add the view and remove other view from the stack and release it.

The problem is one of my view controller is using an object which get xml data from NSURLConnection, parse them and send them to the view controller in order to display them. It works, but sometimes it crashes when I touch another button which causes the release of this view controller.

What is the best way to release it and maybe stop the thread which is getting data ?

Thanks a lot for your help.

Thierry

A: 

Rather than release it, create a Cancel function which sets some boolean flag to true in that class. In the XML parsing section, check that flag. If it's ever true:

[self release];
return;
Ed Marty