I have a UITabBar which has 5 menus. Two of five menus spawn a new thread in viewWillAppear method. In the method, it sends HTTP request to a web server on background. The web server returns data in XML format. After it receives the data, it parses the data and stores the data into local NSMutable array. This part works great but the problem is that if I clicked on one of the tabbar menu from the menu that spawns a new thread, the application crashes. I commented spawning the new thread part out then the application doesn't crash...What might cause this problem?
Asked
Active
Viewed 80 times
1 Answers
0
With no source code it's not easy to tell, but I had similar problems with returning background threads who's delegates where released, because user did something different while the thread was running.

Kai Huppmann
- 10,705
- 6
- 47
- 78
-
[self performSelectorInBackground:@selector(getPosts) withObject:nil]; I use this code in viewWillAppear method for each tap menu.. – codereviewanskquestions Mar 08 '11 at 22:52
-
Also what do you mean by delegates released? – codereviewanskquestions Mar 08 '11 at 22:54
-
What I meant was, when your background thread calls back on some delegate like when finish loading calls [delegate finshedLoading:posts], where delegate is some view controller, but it was released by switching views, that could end in a crash. – Kai Huppmann Mar 09 '11 at 10:30