NSURLErrorDomain Code=-1009

I developed a iOS App, this App need to visit a local url. It can visit the url on iPhone 13 (iOS 15.4) and iPhone 14 Plus (iOS 16.5.1), but it can not visit the same url on iPhone 6s(iOS 15.8.1).

The error message is 'NSURLErrorDomain Code=-1009'.

1). The url can be visited by Safari on iPhone 6s, so the network of iPhone 6s is fine. 2). The Local Network has enabled in the APP settings. 3). I notice that in iPhone Settings -> WLAN -> Apps Using WLAN & Cellular, my App information can be found on iPhone 13 and iPhone 14 Plus, and can not find my App information on iPhone 6s.

How should I troubleshoot this issue? Thanks you!

Follows are full error message.

2024-02-08 17:49:39.706240+0800 AstroeyeWiFi[1186:114419] Task <BD66E19B-7940-40D7-B7C7-921AE6EAAA92>.<8> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x280715c20 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (Denied over Wi-Fi interface), interface: en0, _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <BD66E19B-7940-40D7-B7C7-921AE6EAAA92>.<8>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <BD66E19B-7940-40D7-B7C7-921AE6EAAA92>.<8>" ), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=http://192.168.0.1:50628/form/getDeviceId, NSErrorFailingURLKey=http://192.168.0.1:50628/form/getDeviceId, _kCFStreamErrorDomainKey=1} [DNO][getDeviceSysId][Error] underlying(Alamofire.AFError.sessionTaskFailed(error: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x280715c20 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=unsatisfied (Denied over Wi-Fi interface), interface: en0, _kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <BD66E19B-7940-40D7-B7C7-921AE6EAAA92>.<8>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <BD66E19B-7940-40D7-B7C7-921AE6EAAA92>.<8>" ), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=http://192.168.0.1:50628/form/getDeviceId, NSErrorFailingURLKey=http://192.168.0.1:50628/form/getDeviceId, _kCFStreamErrorDomainKey=1}), nil)

_NSURLErrorNWPathKey=unsatisfied (Denied over Wi-Fi interface), interface: en0,

This looks like a local network privacy failure where the route rule for Wi-Fi is denying this connection. I would double check the local network setting for this case.

BTW: The version of XCode is 14.3 (14E222b). iOS Deployment Target is 11.2, Minimun Deployments is iOS 11.2. The issue still exists if set iOS Deployment Target as 13 and set Minimun Deployments as iOS 13.

I am having the same issue here. my iOS Version: 17.4.1 -> minimum iOS Version: 14

did you find any solution to this problem?

I am having the a similar problem, any solution.

Error -1009 is NSURLErrorNotConnectedToInternet. This is a very generic error, with a lot of different potential causes. If you’re seeing this problem and your circumstances don’t exactly match those described by linjiework, I recommend that you start a new thread about your specific issue.

Use the App & System Services > Networking topic so that I see your new thread.

Share and Enjoy

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

Have you found a solution?

If you know a solution, please share it.

I also have a problem where when a local permission pop-up appears and the connection to the file server fails, the entire app cannot connect to the local server from any file server such as Webdav, FTP, or SMB.

I believe that this problem persists even if you simply reboot the device or reinstall the app.

NSURLErrorDomain Code=-1009
 
 
Q