I have wifi connected in the devices - so this is ruled out.
The Application i have with the same following code executed is able to upload the file to a java server in the iOS 4.3 simulator but unable to upload in iOS 4.3.3 device. This is kind of strange.
ASIFormDataRequest *request_zip = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:strURL]];
[request_zip setAllowCompressedResponse:YES];
[request_zip setPostValue:@"device" forKey:@"value1"]; //pass device ID here...
//[request_zip addRequestHeader:@"Content-Type" value:@"multipart/form-data"];
[request_zip setTimeOutSeconds:20];
[request_zip setDelegate:self];
[request_zip setDidFailSelector:@selector(uploadFailed:)];
[request_zip setDidFinishSelector:@selector(uploadFinished:)];
[request_zip setFile:path forKey:path];
[request_zip startAsynchronous];
NSLog(@"%@ post length",[NSString stringWithFormat:@"%llu",[request_zip postLength]]);
The code when executed results the following output in the terminal.
Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
The post length printed in the console =>
0 post length
There is also a another string comes up lastly, i.e the time out message,
Request failed: The request timed out with response data
100% sure that the server is active and responds immediately for the app executed from simulator.
how is it possible to have a program running in simulator properly but not in the device?
The problem was with the server end. ASIHTTP lib works properly, when ASI tries to transmit the request with post body to server, the apache didnt respond back properly as one of the server configuration was missing probably. The proprietary web library owners fixed it later and the problem is resolved.
It worked in simulator but not in device, why?
It worked in simulator coz the data is transmitted thru the ethernet not wireless, so the transmission rates were great comparatively.
Web service developers has to plz make sure that the data is received even if it comes in from low speed networks
**
ASI libs returned ASCII encoding error, why?
**
This error is returned by ASI immediately once the request goes time - out. This is the cause, but the real internal problem with ASI for this error has to be found out.
Very interesting results fetched end of the day.