本文介绍了NSMutableURLRequest“请求超时"问题 . .的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过使用以下代码在我的应用程序中下载数据

I am trying to download data in my application by using the following code

NSURL *url = [NSURL URLWithString:@"my download url string"];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.f];

NSURLConnection * connection = [NSURLConnection connectionWithRequest:request delegate:self];

[connection start];

但是问题是有时我遇到以下错误

but the problem is some times i am getting the following error

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1d5be240
{NSErrorFailingURLStringKey=http://dr282zn36sxxg.cloudfront.net/datastreams/f-
d%3Afc7f649e1e3ba58452f67e3fa1f66f69a15b96b3ea585c946e4fa854%2BEPUB%2BEPUB.1,
NSErrorFailingURLKey=http://dr282zn36sxxg.cloudfront.net/datastreams/f-
d%3Afc7f649e1e3ba58452f67e3fa1f66f69a15b96b3ea585c946e4fa854%2BEPUB%2BEPUB.1,
NSLocalizedDescription=The request timed out., NSUnderlyingError=0x1e1975b0 "The request
timed out."}

所以,有人可以建议我如何解决这个问题. .

so , can anybody suggest me how to solve this . . .

推荐答案

增加超时间隔,例如150秒.

Increase the timeout interval like 150 secs .

这篇关于NSMutableURLRequest“请求超时"问题 . .的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:09