iOS · Cannot Connect to Host

iOS Error Code -1004

The host was found, but the connection could not be established.

errorLast verified 2026-11-08Apple Developer: NSURLErrorDomain
Quick answer

The host was found, but the connection could not be established.

Code-1004
ProductiOS
Company / originApple · United States
CategoryMobile Platforms
Platform / versionsiOS 15 and later · NSURLErrorDomain
Severityerror
Official sourceApple Developer: NSURLErrorDomain ↗
Last verified2026-11-08

What does iOS error -1004 mean?

NSURLErrorCannotConnectToHost (-1004) means DNS succeeded but the TCP connection failed. The server may be down, the port may be blocked, or the network may be filtering the connection.

Common causes

  • The server is not listening on the requested port.
  • A firewall, carrier, or corporate network is blocking the connection.
  • The app is using the wrong host or port for this environment.

How to fix it

  1. Step 1

    Test the host and port from another network.

  2. Step 2

    Verify the server is running and the firewall allows mobile clients.

  3. Step 3

    Check the app's environment configuration for a wrong base URL.

When to escalate

Before you escalate: If an iOS URL error persists on Wi-Fi and cellular, after restarting the app and the device, capture the code, the URL, the time, and the Console log for the app, then contact the app developer or Apple Support.

Related codes

CodeNameWhat it means
-1005The Network Connection Was LostThe connection was established but then dropped.
-1001The Request Timed OutThe request did not complete before the timeout.
-1003Cannot Find HostThe hostname could not be resolved.
-1006Cannot Find HostThe DNS lookup for the host failed.
-1009The Internet Connection Appears to Be OfflineThe device is not connected to the internet.

Source & verification

This page was checked against Apple Developer: NSURLErrorDomain on 2026-11-08. The code, product, and platform fields are kept separate from the explanation so corrections can be made without changing the URL.

Open Error Codes is independent and not affiliated with Apple. Always confirm destructive or security-sensitive steps with the official documentation.