// Session配置TQUICURLSessionConfiguration *quicSessionConfiguration = [TQUICURLSessionConfiguration defaultConfiguration];// 拥塞控制算法quicSessionConfiguration.congestionType = TQUICCongestionTypeBBR;// 连接超时时间quicSessionConfiguration.connectTimeoutMillis = 6 * 1000;TQUICHTTPSessionManager *quicSessionManager = [[TQUICHTTPSessionManager alloc] initWithSessionConfiguration:quicSessionConfiguration];// 发起GET请求[quicSessionManager GET:@"url"parameters:nilheaders:niltimeoutInterval:0downloadProgress:nilsuccess:^(TQUICURLSessionTask * _Nonnull task, id _Nullable responseObject) {// 请求执行成功,获取响应数据// 获取 Headers,由于是 HTTP 协议,因此这里 response 可以强转为 NSHTTPURLResponseNSDictionary *headers = [(NSHTTPURLResponse *)task.response allHeaderFields];// 获取 Bodyid body = responseObject;} failure:^(TQUICURLSessionTask * _Nullable task, NSError * _Nonnull error) {// 请求执行失败,获取错误信息NSInteger errorCode = error.code;}];
// Session配置TQUICURLSessionConfiguration *quicSessionConfiguration = [TQUICURLSessionConfiguration defaultConfiguration];// 拥塞控制算法quicSessionConfiguration.congestionType = TQUICCongestionTypeBBR;// 连接超时时间quicSessionConfiguration.connectTimeoutMillis = 6 * 1000;TQUICHTTPSessionManager *quicSessionManager = [[TQUICHTTPSessionManager alloc] initWithSessionConfiguration:quicSessionConfiguration];//构造body数据NSData *bodyData;//发起Post请求[quicSessionManager POST:@"url"body:bodyDataheaders:niltimeoutInterval:timeIntervaluploadProgress:^(NSProgress * _Nonnull uploadProgress) {} success:^(TQUICURLSessionTask * _Nonnull task, id _Nullable responseObject) {// 请求执行成功,获取响应数据// 获取 Bodyid body = responseObject;} failure:^(TQUICURLSessionTask * _Nullable task, NSError * _Nonnull error) {// 请求执行失败,获取错误信息NSInteger errorCode = error.code;}];
// 创建SessionManager...TQUICURLSessionDataTask *dataTask =[quicSessionManager dataTaskWithRequest:requestuploadProgress:nildownloadProgress:nilcompletionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {//请求完成回调}];//发起请求[dataTask resume];//取消请求[dataTask cancel];
本页内容是否解决了您的问题?