NSURLErrorDomain Code=-1001 🍎 iOS

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."

The server didn’t respond within URLSession’s timeout (60 s default) — slow server, unreachable host on this network, or a stalled connection.

Seen on: iOS

Meaning

Local dev servers addressed as localhost from a device (localhost is the phone), firewalls, IPv6-only networks, or a long backend operation cause timeouts.

Common causes

  • Server slow or overloaded
  • Device calling localhost/127.0.0.1 (points to the phone)
  • Firewall/VPN blocking
  • Long-running request without streaming/polling

⚡ Quick fix

  1. Use the Mac’s LAN IP or a tunnel when testing on device
  2. Raise timeoutIntervalForRequest for slow endpoints
  3. Make long operations asynchronous on the server

Detailed fix by platform

Swift

  1. swift
    var request = URLRequest(url: url)
    request.timeoutInterval = 120

How to diagnose

  1. Host — Reachable from the device?
  2. Server — Response time
  3. Network — Works on Wi-Fi vs cellular?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.