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

**Code:** `NSURLErrorDomain Code=-1001` · **Category:** iOS · **Seen on:** iOS

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ios/nsurlerror-1001-request-timed-out)
