AWS iOS SDK 1.7.1 Network Connection Lost - ios

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];

Related

Codename One Networking issue on 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.

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"];

AFNetworking : Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost.", _kCFStreamErrorCodeKey=-4

I need to call a web service (post) on every 30 seconds. For first 3-4 times it works fine , but after 3-4 hits it gives error :
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSErrorFailingURLStringKey=My_URL, _kCFStreamErrorCodeKey=-4.
Please note that, Same web service hits from android app and postman then it works fine for everytime (no matter how many times you hit). I am using iphone device, I have also tried on simulator but still same issue. I have also checked my enitre code (check all values at run time before call web services) , all is fine. Any idea what's going wrong. Any suggestion will be great. Thanks in advance.

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.

Resources