0
votes

I'm in a trouble with ASIHTTPRequest.

First of all in my AppDelegate I have a TabBarController. Before set my tabbarcontroller to the rootviewcontroller (self.window.rootViewController = self.tabBarController;)
I push another view (self.window.rootViewController = getDataLaunchViewController;) which is in charge of download all the data. Inside this view controller(getDataLaunchViewController) I'm doing a couple of startAsynchronous request. Everything is alright, I get the response but when the last request is done, I'm trying to do this (inside the requestFinished):

AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

appDelegate.window.rootViewController = appDelegate.tabBarController;

and the App crash with EXC_BAD_ACCESS

I've done a research and I'm not too much sure what am I doing wrong...

1

1 Answers

1
votes

I think the problem is that you are working in the same thread. I suggest you doning a "manual trick". Build a method with your code:

AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
appDelegate.window.rootViewController = appDelegate.tabBarController;

After, when you receive the last request, call this method like this:

[self performSelector:@selector(yourMethod) withObject:nil afterDelay:0.1];

I hope it will help you!!