-(instancetype)initWithDataTaskWithUrlRequest:(NSURLRequest *)request WithIdentifierIndex:(NSString*)identifier
{
self = [super init];
if (self) {
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:[NSString stringWithFormat:@"%@",[self uuid]]];
configuration.HTTPMaximumConnectionsPerHost = 1;
operationSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration ephemeralSessionConfiguration] delegate:self delegateQueue:nil];
_sessionDataTask = [operationSession dataTaskWithRequest:request];
}
return self;
}
我有一个操作队列。并且在每个NSOperation
我都使用会话来下载内容。我有ephemeralSessionConfiguration
和DefaultSessionConfiguration
。它适用于200 0r 300次操作。但是当操作增加到1000到1000+时,它会给我超时,握手错误。请帮助我寻求最佳解决方案。
答案 0 :(得分:0)
在同一NSURLSessionConfiguration
中,您可以添加/增加超时:
configuration.timeoutIntervalForRequest = KTimeOutValue; //Your timeout value