简体   繁体   中英

ASIHTTPRequest Delegate Methods not being called

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?

To answer my own question:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM