NSURLErrorDomain: -1003 Error

Hi,

I have been running into this error whenever I try to send https request from my ios simulator to my server. Below is my code for sending request:
Code Block      let url = URL(string: "https://www.mywebsite.com/signin")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
     
    NSURLConnection.sendAsynchronousRequest(request, queue: OperationQueue.main) {(response, data, error) in
      guard let data = data else { return }
      print(String(data: data, encoding: .utf8)!)
    }

I have ssl certificate from letsencrypt setup on my server and it works fine with Android, Chrome and tests well with SSL Lab.

I know that NSURLErrorDomain: -1003 Error means can't find the host, but I have no idea why it couldn't find this host.

BTW: I have ATS disabled in info.plist.

Any help would be greatly appreciated.
OK, before we go further, why are you using NSURLConnection? It’s been deprecated for coming up on 5 years now!

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

It's now 2025, I'm using the latest Xcode, the latest Simulator, the latest everything. My code is not referencing NSURL (afaik) yet still...

       let task = URLSession.shared.dataTask(with: urlRequest) 

And getting a message

NSURLErrorDomain Code=-1003

Have the error messages been updated?

NSURLErrorDomain: -1003 Error
 
 
Q