afnetwork 又一个坑“The request timed out”

来源:互联网 发布:dnf和队友网络冲突 编辑:程序博客网 时间:2024/06/06 12:17
使用afn连续多个网络请求会出现错乱
比如for循环中连续请求,导致本来抓包已经正确返回数据的请求收到的确实error,  在urlconnection中

- (void)connection:(NSURLConnection __unused *)connection

  didFailWithError:(NSError *)error

{

    self.error = error;


    [self.outputStream close];

    if (self.responseData) {

        self.outputStream = nil;

    }


    self.connection = nil;


    [self finish];

}


error报错为The request timed out

解决:

 超时时间设置更长一些...

timeout属性

0 0