Codename One Networking issue on ios - ios

After a recent update we've been getting some major issues with networking on iOS in our Codename One app.
Everything works for a short time and then network requests start failing with the error;
"The network connection was lost."
It seems like it may be realated to the issue described here;
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
I attempted to add the "Connection : close" header to the apps network requests but it seemed to have no effect.

This issue should be resolved in the latest update, there was indeed an issue with cookie handling in some cases.

Related

Randomly getting Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.”

I'm randomly getting Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.”
I immediately try again and it works. Different devices with different networks. Also happens when using WiFi on the device or simulator.
What is the issue?
Typically, it means that the network connection is being lost. When this happens, ask reachability to tell you when it's a good time to try again, then try again.
IIRC, it also can occur with certain programming errors that cause some servers to drop the connection immediately, such as trying to pass a request body in a GET request, but I may or may not be remembering correctly.
Try this:
[self.manager.requestSerializer setValue:#"close" forHTTPHeaderField:#"Connection"];

Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.” - Occurs in iOS 9 with https

The error logged (on iOS 9):
Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.”
It occurs frequently with https:// request and with http:// it works far more better, but still it throws error sometimes.
Is this error because of https call? Do we need to have http request for iOS 9 in order to resolve this issue?
Thanks in advance.
This usually means that your network connection dropped out while making the request... Do you have a good strong internet connection? Are you seeing issues when using other apps/programs?
Is this happening on the device or simulator? Try resetting the simulator or restarting the device.
You aren't monitoring network traffic via a proxy are you? You can sometimes run into issues like this when SSL verification fails because for example you are monitoring network traffic via tools such as Charles.
Does the server you are talking with (https one) have a valid and trusted SSL certificate? Could be related to that too.

Could not determine current country code: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."

Can't load map in one of my view controllers. I checked the other stackoverflow post: NSURLConnection GET request returns -1005, "the network connection was lost" but it isnt working for me.
Here is an image of my view controller and error message:
I've tried resetting content settings, relaunching simulator and different wifi connections.
Do you guys have any other suggestions?
"The network connection was lost" means exactly that. Your device lost its network connection. Can happen with any device, any time. Your app should handle this gracefully.
Looking at your own reply: So if a customer runs into this problem, you are going to visit them and set up a proxy for them?
Restart your simulator and run it. Then it will works fine.
Using Charles or setting up a Secured Web Proxy (HTTPS) solved the problem for me.

Parse iOS SDK Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." on mobile network

I get this error in my iOS app using Parse SDK. The strange thing is that i only get this error when i'm NOT using wifi. On wifi it works just fine.
Could it be some bug with the Parse SDK version 1.5? Does anyone else get this error?
Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
UserInfo=0x7fe8c2e25130 {NSUnderlyingError=0x7fe8c2c63940 "The network connection was lost.",
NSErrorFailingURLStringKey=https://api.parse.com/2/find,
NSErrorFailingURLKey=https://api.parse.com/2/find, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=57,
NSLocalizedDescription=The network connection was lost.}
(Code: 100, Version: 1.5.0)
I experienced this with slow internet connections (3G especially) and when I had big sized objects like a table view with a lot high quality images. Sometimes it just happens without any serious reasons. I think it's a network issue not a Parse bug. Parse handles these situations very good, it tries to reconnect in every 2/3 seconds. International bandwidth can be a reason too, maybe you are far from the server.
I had similar issue, this is to do with internet speed. when signal is low, this issue occurs. Sometime by refreshing network or close/opening the xcode does help.

AWS iOS SDK 1.7.1 Network Connection Lost

I have some code that has been in production for a while now and all of a sudden doesn't work at all. I am getting an error that looks like:
[S3Response connection:didFailWithError:]|234|UserInfo.NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork Code=-1005 "The network connection was lost." UserInfo=0x15514d30 {NSErrorFailingURLKey=https://our-bucket-name.s3.amazonaws.com/t46945%2Fx0f04n77vo3724ky_3000.mp4}
There is also an issue where the SDK calls both the request:didFailWithError: and request:didCompleteWithResponse: are both called for a single request. I was doing some digging and saw there is a similar issue for GetObject.
We are getting a crash because when we start a request we enter a dispatch group and leave it on the completion or failure of the request but when both all called it throws an exception and crashes the app.
Any help as to why this is happening would be great.
After running the network connections through my computer and using Charles to inspect the traffic it turns out that Amazon was returning an error for RequestTimeTooSkewed but it doesn't make it to the error. The devices had their times manually adjusted. I now have a server side api endpoint to get the current server time and calculate the device difference. You can then set the runtimeClockSkew by calling [AmazonSDKUtil setRuntimeClockSkew:difference];

Resources