我知道 Ben 放弃了 ASIHTTPRequest 项目,但无论如何现在切换到其他东西为时已晚,所以我决定尝试解决我遇到的问题。
我正在发布和使用 https 协议的请求。我已按要求禁用了持久连接。
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setUseKeychainPersistence:YES];
[request setShouldAttemptPersistentConnection:YES];
// Set the request timeout
[request setTimeOutSeconds:REQUEST_TIME_OUT];
// Upload an image
NSData *imageData = UIImagePNGRepresentation(imageContainer.mImage);
[request setPostBody:[NSMutableData dataWithData:imageData]];;
[request setDelegate:self];
[request setDidFinishSelector:@selector(uploadRequestFinished:)];
[request setDidFailSelector:@selector(uploadRequestFailed:)];
[request startAsynchronous];
以及我得到A connection failure occurred
的所有东西kCFErrorDomainCFNetwork error -1005
。
我已经在项目的配置中启用了所有调试信息,ASIHTTPRequest
并获得了以下日志
[STATUS] Starting asynchronous request <ASIFormDataRequest: 0x1029e000>
[CONNECTION] Request <ASIFormDataRequest: 0x1029e000> will not use a persistent connection
[THROTTLING] ===Used: 0 bytes of bandwidth in last measurement period===
[THROTTLING] ===Used: 327680 bytes of bandwidth in last measurement period===
[CONNECTION] Request attempted to use connection #(null), but it has been closed - will retry with a new connection
[CONNECTION] Request <ASIFormDataRequest: 0x1029e000> will not use a persistent connection
[THROTTLING] ===Used: 229376 bytes of bandwidth in last measurement period===
[THROTTLING] ===Used: 360448 bytes of bandwidth in last measurement period===
[CONNECTION] Request attempted to use connection #(null), but it has been closed - we have already retried with a new connection, so we must give up[STATUS] Request <ASIFormDataRequest: 0x1029e000>: Failed
[CONNECTION] Request #(null) failed and will invalidate connection #(null)ata upload failed "Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0xf624750 {NSUnderlyingError=0xf6246f0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)"
任何想法为什么会发生崩溃?以及如何解决这个问题?