Error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
Solution 1:
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.
Solution 2:
iOS Simulator -> Reset Content and Settings; worked for me
Solution 3:
Had this problem and had a different resolution so I thought I'd add it here:
Basically, I was sending some parameters when it should have been a clean GET request. Deleted the parameters, GET request worked just fine.