iphone - Issue with ASIHTTPRequest -
i understand asihttprequest project abandoned ben, anyway late me switch else decided try deal issue have.
i'm posting , request https protocole. i've disabled persistence connection on request.
asiformdatarequest *request = [asiformdatarequest requestwithurl:url]; [request setusekeychainpersistence:yes]; [request setshouldattemptpersistentconnection:yes]; // set request timeout [request settimeoutseconds:request_time_out]; // upload image nsdata *imagedata = uiimagepngrepresentation(imagecontainer.mimage); [request setpostbody:[nsmutabledata datawithdata:imagedata]];; [request setdelegate:self]; [request setdidfinishselector:@selector(uploadrequestfinished:)]; [request setdidfailselector:@selector(uploadrequestfailed:)]; [request startasynchronous]; and i'm getting a connection failure occurred kcferrordomaincfnetwork error -1005.
i've enabled debug info in configs of asihttprequest project , have got following log
[status] starting asynchronous request <asiformdatarequest: 0x1029e000> [connection] request <asiformdatarequest: 0x1029e000> not use 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 use connection #(null), has been closed - retry new connection [connection] request <asiformdatarequest: 0x1029e000> not use 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 use connection #(null), has been closed - have retried new connection, must give up[status] request <asiformdatarequest: 0x1029e000>: failed [connection] request #(null) failed , invalidate connection #(null)ata upload failed "error domain=asihttprequesterrordomain code=1 "a connection failure occurred" userinfo=0xf624750 {nsunderlyingerror=0xf6246f0 "the operation couldn’t completed. (kcferrordomaincfnetwork error -1005.)" any ideas why crash happens ? , how fix ?
i had same issue several months ago. internet connections not guaranteed , find error more common on 3g connection. solution raise retry count. inside of asihttprequest.m modify retry count @ least 5 , see if helps.
- (bool)retryusingnewconnection { if ([self retrycount] < 5) { the reason why works because error -1005 caught in -handlestreamerror connection retried many times allowed in above code.
Comments
Post a Comment