Error: Error Domain=NSURLErrorDomain Code=-1001 The request timed out.
There was no issue in the code. I guess the simulator internally was not able to connect to the internet, so that is why it was not able to connect to the server after providing various timeout intervals. But it worked completely fine when I executed another day. Thanks to @Andrew Jaffee for helping me to find this issue.
I get Error Domain=NSURLErrorDomain Code=-1001 The request timed out. on iOS devices but works fine on android
The solution was to not send body with a GET request.
I knew it did not follow the request pattern for GET. Thought it was possible.
It was bad project planning on my part. One of my first own projects as a developer. All identifying information that is not secret should be kept inside the token. So when sending get requests the header with token has all the information needed to filter what data is sent back to the user.
Good luck and hope it helps!
NSURLErrorDomain code =-1001 request getting timed out
From the documentation:
Timeout
You can set a custom timeout value (in seconds):
[UNIRest timeout:2];
By default the timeout is 60.
NSURLErrorDomain Code=-1001 error when a http post request is sent
Apparently my post request was getting a timeout error since I was sending an image that the server would find too large. I scaled down the images in order to make my images acceptable by the server.
As this post suggests, NSURLErrorDomain Code=-1001
error might be caused by many things including;
- Server response time limit
- Server rules about the incoming data
- Authentication problems
Hope that helps to other people
Related Topics
Removing Duplicates from Array of Custom Objects Swift
Programmatically Add Centerx/Centery Constraints
Find the Tangent of a Point on a Cubic Bezier Curve
Programmatically Switching Between Tabs Within Swift
How to Change the Background Color of the Uialertcontroller
How Does Xcode Find Implicit Target Dependencies
Negative Number Modulo in Swift
Button Action in Custom Uitableviewcell Affects Other Cells
How to Get Data from Firebase in Descending Order of Value
What Is a "Delegate" in Objective C's iPhone Development
Possible to Handle Your Own Http Url Schemes in iOS
How to Change Uibutton Image in Swift
Crashlytics in iOS Won't Proceed Past "Build Your Project" in Fabric App