当 ASI-HTTP-Request 超时时,会调用什么委托方法?

发布于 2024-09-11 15:31:29 字数 135 浏览 1 评论 0原文

我有一个使用 ASI-HTTP-Request 处理大文件的应用程序,最近有一位测试人员注意到他们观察到很长的加载延迟,这应该表现为超时。我已经为请求失败连接了委托方法,但这些似乎没有发生。

我仔细阅读了他们的文档,但没有看到任何具体内容。

I have an app that uses ASI-HTTP-Request for large files, and I had a tester recently note that they wer observing very long loading delays that should be manifesting as timeouts. I have delegate methods wired up for request failures, but these didn't seem to be happening.

I poured through their documentation but didn't see anything specific.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国际总奸 2024-09-18 15:31:29

ASIHTTPRequest.m 中,查看 -checkRequestStatus 方法。

发生超时时,请求会失败并显示 ASIRequestTimedOutError 错误类型:

[self failWithError:ASIRequestTimedOutError];

因此您应该能够检查委托的 -requestFailed: 方法中返回的错误:

- (void)requestFailed:(ASIHTTPRequest *)request {
    NSLog(@"Error: %@",[[request error] localizedDescription]);
}

这是一个好主意通读源代码以粗略地了解事情是如何工作的。文档很棒,但并不总是与源代码同步。

In ASIHTTPRequest.m, look in the -checkRequestStatus method.

When a timeout occurs, the request fails with an ASIRequestTimedOutError error type:

[self failWithError:ASIRequestTimedOutError];

So you should be able to check the error returned in the delegate's -requestFailed: method:

- (void)requestFailed:(ASIHTTPRequest *)request {
    NSLog(@"Error: %@",[[request error] localizedDescription]);
}

It's a good idea to read through the source to get a rough feel for how things work. The documentation is great, but not always in sync with the source code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文