0
votes

The scenario:

ViewControllerA.m sets up the ASIHTTPRequest with ViewControllerB.m being the delegate, passes it to ServerIO.m to start the ASIHTTPRequest, and ViewControllerA pushes view controller to ViewControllerB.

However, the delegate methods are not being called. Here's the code:

ViewControllerA.m

ViewControllerB *drc = [[ViewControllerB alloc] initWithRequestID:requestID];

[self.navigationController pushViewController:drc animated:YES];

[ServerIO findRooms:[NSDictionary dictionaryWithObjectsAndKeys:drc, @"delegateController", nil]];`

ServerIO.m

[request setDelegate:[parameters objectForKey:@"delegateController"]]; //I checked the delegate here and it's valid.

I have already added in ViewControllerB.m, but the delegate methods are not being called there. Any ideas?

1
You are calling method of ServerIO.m after pushing another view controller, you need to call this from the viewDidload/viewWillAppear of ViewControllerBrishi

1 Answers

0
votes

To answer my own question:

You must use the instance methods (-), not the class methods (+).