request body stream exhausted错误解决方案
来源:互联网 发布:sem与seo的区别 编辑:程序博客网 时间:2024/06/12 23:44
AFNetworking 2.0上传图片时的错误信息如下:
Error Domain=NSURLErrorDomain Code=-1021 "request body stream exhausted" UserInfo={NSUnderlyingError=0x1522c29d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1021 "request body stream exhausted" UserInfo={NSErrorFailingURLStringKey=http://******/resource_upload, NSLocalizedDescription=request body stream exhausted, NSErrorFailingURLKey=http://******/resource_upload}}, NSErrorFailingURLStringKey=http://******/resource_upload, NSErrorFailingURLKey=http://******/resource_upload, NSLocalizedDescription=request body stream exhausted}
解决方案:
直接添加一个AFURLConnectionOperation的category类,实现如下代码即OK。
#import "AFURLConnectionOperation+AuthenticationChallengeUploadFix.h"@implementation AFURLConnectionOperation (AuthenticationChallengeUploadFix)- (NSInputStream *)connection:(NSURLConnection __unused *)connection needNewBodyStream:(NSURLRequest *)request { //苹果默认网络请求缓冲区复用,当缓冲区溢出后需要重新开辟缓冲区。否则溢出的数据无法上传服务器。 if ([request.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { return [request.HTTPBodyStream copy]; } return nil;}@end
0 0
- request body stream exhausted错误解决方案
- Required request body is missing 错误解决
- git 提示Push错误“Error writing request body to server”
- [DUBBO] Thread pool is EXHAUSTED! 关于duboo provider并发限流的错误及解决方案
- php错误:failed to open stream: HTTP request failed!
- php错误提示failed to open stream: HTTP request failed!
- “Request 对象 错误 'ASP 0104 : 80004005'”解决方案
- “Request 对象 错误 'ASP 0104 : 80004005'”解决方案
- 显示HttpServletRequest request中的body
- spring 将request body 转存...
- HttpListener下读取request body
- Node.js request.body undefined
- 解决:PHP file_get_contents函数failed to open stream: HTTP request failed!错误
- “Request 对象 错误 ‘ASP 0104 : 80004005′”解决方案
- SOAP namespace(命名空间) 错误生成到 body 里的解决方案
- Request body二次取得的问题
- spring MVC 获取request中的body体
- jQuery posting valid json in request body
- Linux内存
- C#中Math.Round()实现中国式四舍五入
- codeforces 593 D. Happy Tree Party (LCA + 并查集)
- intellij idea下搭建android环境遇到的rendering problem问题及部分解决方式
- 疯狂HTML-01
- request body stream exhausted错误解决方案
- MyBatis使用Collection查询多对多或一对多结果集bug
- hibernate与mybatis异同与比较(涵盖网上各个版本,清晰明了)
- 漫谈CSS transform动画技术
- iOS JPush极光推送
- leetcode15 3sum
- leetcode 4 Median of Two Sorted Arrays
- linux kernel内存碎片防治技术
- JQuery基础列表