NSURLErrorDomain Code=-1009 🍎 iOS

Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."

URLSession couldn’t reach the network — the device is offline, the app’s cellular data is disabled, or the simulator lost network access.

Seen on: iOS

Meaning

Besides real offline states, iOS can block an app from cellular data (Settings → app → Mobile Data), VPN/content filters interfere, and simulators lose connectivity when the Mac changes networks.

Common causes

  • Device/simulator offline
  • Cellular data disabled for the app
  • VPN/proxy/content filter blocking
  • First-launch network permission (China region) not granted

⚡ Quick fix

  1. Check connectivity and the app’s cellular setting
  2. Restart the simulator after network changes
  3. Handle offline states gracefully (NWPathMonitor, waitsForConnectivity)

Detailed fix by platform

Swift

  1. swift
    let config = URLSessionConfiguration.default
    config.waitsForConnectivity = true
    let session = URLSession(configuration: config)

How to diagnose

  1. Network — Other apps online?
  2. Settings — Cellular data for the app
  3. Simulator — Restarted?

🔧 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.