我在 UpdateViewController 中有一个函数,它由委托 MyDownloadController 调用,它将关闭模式视图(即 UpdateViewController)。
-(void)errorDownloading {
self.downloadController.delegate = nil;
[downloadController release];
[self dismissModalViewControllerAnimated:YES];
}
我已经尝试在有和没有弄乱委托指针的情况下这样做,但它仍然没有关闭视图。
委托在 MyDownloadController 中调用这样的方法:
-(void)connectionError {
if([delegate respondsToSelector:@selector(errorDownloading)]){
[delegate errorDownloading];
}
}
此函数由不同的委托 (MyConnectionController) 调用。
有这么多代表有什么问题吗?指针错误或与它们有关的东西会影响模态视图能够关闭吗?如果是这样,如何/为什么?
我有这样的代表团结构:
UpdateViewController (the actual modal view I am trying to close)
|- MyDownloadController (the controller that abstracts the process being done)
|- MyConnectionController (a helper class I wrote to interact with NSURLConnection)
|- NSURLConnection
诊断此问题的最佳方法是什么?