且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASIHTTPRequest,EXC_BAD_ACCESS请求完成后

更新时间:2022-06-27 07:05:40

你确定你的类实现 - (void)requestFinished:(ASIHTTPRequest *)请求仍然在请求完成时?看起来像我的班级得到释放太​​早。请注意,委托属性不保留其内容。

Are you sure that your class that implements - (void)requestFinished:(ASIHTTPRequest *)request is still there when the request finishes? It looks to me like the class gets deallocated too early. Note that the delegate property does not retain its content.

您可以添加 [自我保留] to doDownload [self release] to - (void)requestFinished :( ASIHTTPRequest *)请求,但请确保(!) [self release] 也不会调用经常。如果请求永远不会完成,这也可能是内存泄漏。***保留你的课程在其他地方。

You could add a [self retain] to doDownload and a [self release] to - (void)requestFinished:(ASIHTTPRequest *)request, but make sure (!) that [self release] doesn't get called too often. This is also a possible memory leak if a request would never finish. It would be best to retain your class somewhere else.

您也可以尝试使用 NSZombieEnabled 设置为 YES 找到错误。

You might also try to debug with NSZombieEnabled set to YES to find the error.