When using the NEHotspotConfigurationManager applyConfiguration interface for network connection, there is a certain probability of encountering the "Unable to join network" error. We captured the system logs when the issue occurred, some errors are due to the network not being scanned, while others are rejected by the system(console logs like:WCLScanManager scan is blocked by other system activity 32 or 9). If there are any methods to optimize or avoid these errors?
Networking
RSS for tagExplore the networking protocols and technologies used by the device to connect to Wi-Fi networks, Bluetooth devices, and cellular data services.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I am developing an iOS application using NWPathMonitor for network connectivity monitoring. We discovered a reproducible issue where disabling and re-enabling WiFi triggers an unexpected network status sequence.
ENVIRONMENT:
iOS Version: 17.x
Device: iPhone (various models tested)
Network Framework: NWPathMonitor from iOS Network framework
STEPS TO REPRODUCE:
Device connected to WiFi normally
Disable WiFi via Settings or Control Center
Re-enable WiFi via Settings or Control Center
EXPECTED BEHAVIOR:
WiFi reconnects and NWPathMonitor reports stable satisfied status
ACTUAL BEHAVIOR:
T+0s: WiFi re-enables, NWPathMonitor reports path.status = .satisfied
T+8s: NWPathMonitor unexpectedly reports path.status = .unsatisfied with unsatisfiedReason = .notAvailable
T+9-10s: NWPathMonitor reports path.status = .satisfied again
Connection becomes stable afterward
NETWORK PATH TIMELINE:
T+0s: satisfied (IPv4: true, DNS: false)
T+140ms: satisfied (IPv4: true, DNS: true)
T+8.0s: unsatisfied (reason: notAvailable, no interfaces available)
T+10.0s: satisfied (IPv4: true, DNS: true)
KEY OBSERVATIONS:
Timing consistency: unsatisfied event always occurs ~8 seconds after reconnection
resolution: "Reset Network Settings" eliminates this behavior
TECHNICAL QUESTIONS:
What causes the 8-second delayed unsatisfied status after WiFi re-enablement?
Is this expected behavior that applications should handle?
Why does reset network setting in iPhone fix this issue?
Question: Best Practice for NEFilterRule and NENetworkRule Initializers with Deprecated NEHostEndpoint?
Hi all,
I'm looking for guidance on the right way to construct an NEFilterRule that takes a NENetworkRule parameter. Reading the latest documentation, it looks like:
All initializers for NENetworkRule that accept an NEHostEndpoint are now deprecated, including initWithDestinationHost:protocol: and those using the various *Network:prefix: forms. NEHostEndpoint itself is also deprecated; Apple recommends using the nw_endpoint_t type from the Network framework instead.
However, NEFilterRule still requires a NENetworkRule for its initializer (docs).
With all NENetworkRule initializers that take NEHostEndpoint deprecated, it’s unclear what the recommended way is to create a NENetworkRule (and thus an NEFilterRule) that matches host/domain or network traffic.
What’s the proper way to construct these objects now—should we create the endpoints using nw_endpoint_t and use new/undocumented initializers, or is there an updated approach that’s considered best practice?
Helpful doc links for reference:
NEFilterRule docs
NENetworkRule docs
NWHostEndpoint (now deprecated)
If I was to build an app that opened a web server at local host on a random port that resolved subdomains for local host at that port, but there was no certificate authority, signed certificate available to provide HTTPS security, would this be in violation of apples ATS policy
I have few API's written with URLSession. Will they work in Carrier-constrained network / satellite mode ?
I'm creating a custom VPN app which should only work on Cellular. Apart from cellular interface binding VPN is working fine. Even though I specified cellular interface like
let cellularParams = NWParameters.udp
cellularParams.requiredInterfaceType = .cellular
It is going via Wifi when it is ON. I know this is the default iOS behaviour.
How can I prevent this and route through cellular only even when Wifi is enabled on device?
Hi everyone,
I’m encountering what appears to be a system-level issue with NEAppPushProvider extensions being unable to communicate with other devices on the local network, even when the main app has already been granted Local Network permission by the user.
Context
The following problem occurs in an iPad app running iOS 18.5.
The main app successfully requests and is granted Local Network access via NSLocalNetworkUsageDescription in its Info.plist configuration. It can connect to a WebSocket server hosted on the local network without any issues, resolving its address by name.
The extension (NEAppPushProvider) uses the same networking code as the app, extended via target membership of a controller class. It attempts to connect to the same hostname and port but consistently fails to establish a connection. The system log shows it properly resolving DNS but being stopped due to "local network prohibited". An extract of the logs from the Unified Logging System:
12:34:10.086064+0200 PushProvider [C526 Hostname#fd7b1452:8443 initial parent-flow ((null))] event: path:start @0.000s
12:34:10.087363+0200 PushProvider [C526 Hostname#fd7b1452:8443 waiting parent-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi)] event: path:satisfied @0.005s
12:34:10.090074+0200 PushProvider [C526 Hostname#fd7b1452:8443 in_progress parent-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi)] event: flow:start_connect @0.006s
12:34:10.093190+0200 PushProvider [C526.1 Hostname#fd7b1452:8443 in_progress resolver (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi)] event: resolver:start_dns @0.009s
12:34:10.094403+0200 PushProvider [C526.1.1 IPv4#f261a0dc:8443 waiting path (unsatisfied (Local network prohibited), interface: en0[802.11], ipv4, uses wifi)] event: path:unsatisfied @0.010s
12:34:10.098370+0200 PushProvider [C526.1.1.1 IPv4#f261a0dc:8443 failed path (unsatisfied (Local network prohibited), interface: en0[802.11], ipv4, uses wifi)] event: null:null @0.014s
12:34:10.098716+0200 PushProvider [C526.1 Hostname#fd7b1452:8443 failed resolver (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi)] event: resolver:children_failed @0.015s
12:34:10.099297+0200 PushProvider [C526 Hostname#fd7b1452:8443 waiting parent-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, uses wifi)] event: flow:child_failed @0.016s
What I’ve Confirmed:
The extension works perfectly if the DNS is changed to resolve the name to a public IP instead of a local one. The extension always connects by hostname.
Devices on the local network can resolve each other’s IP addresses correctly and respond to pings.
What I’ve Tried
Adding NSLocalNetworkUsageDescription to the main app’s Info.plist, as recommended.
Clean building the project again.
Removing and reinstalling the app to ensure permission prompts are triggered fresh.
Restarting the iPad.
Ensuring main app cannot access the local network until the permission is granted.
Ensuring the main app has connected to the same hostname and port before the extension attempts a connection
Toggling the permission manually in Settings.
Apple’s documentation states (TN3179):
“In general, app extensions share the Local Network privilege state of their container app.”
It also notes that some background-running extension types may be denied access if the privilege is undetermined. But in my case, the main app clearly has Local Network access, and the extension never receives it, even after repeated successful connections by the main app.
Question
Is this a known limitation with NEAppPushProvider? Is there a recommended way to ensure the extension is able to use the local network permission once the user has granted it on the app?
Any feedback, suggestions, or confirmation would be greatly appreciated. Thanks in advance.
I have a requirement to create a VPN app which only works on Cellular. But I'm facing an issue like when wifi is ON, OS is using wifi interface to route the traffic instead of cellular. I tried some ways like
let cellularParams = NWParameters.udp
cellularParams.requiredInterfaceType = .cellular
But this is not working properly as expected. How can I manually bind to cellular interface in iOS?
We have an application which is written in Swift, which activates Transparent Proxy network extension. We want to use MDM deployment for this network system extension.
Our Transparent Proxy module is a system extension, which is exposing an app proxy provider interface (We are using NETransparentProxyProvider class and in extension’s Info.plist we use com.apple.networkextension.app-proxy key.) We don’t have any remote server setup to forward the traffic, instead we open a connection with a certain localhost:port (127.0.0.1:3128) to redirect the traffic which is received in our transparent proxy. We have another module that listens to the particular localhost:port to process the traffic further.
As per https://developer.apple.com/documentation/devicemanagement/vpn/transparentproxy documentation, we noticed that we can use the VPN payload with app-proxy as Provider Type for Transparent Proxy.
By referring this document, we created the profile.
If we provide "127.0.0.1" as RemoteAddress field, we were able to install the profile and also while installing our product, the Transparent Proxy gets mapped with the one which is installed via profile. However after that the network is broken and hence unable to browse anything.
We are suspecting the remote server(RemoteAddress) filed is causing this. What value should be provided in the RemoteAddress field?
We are developing a client server application using TCP bsd sockets.
When our client is connected to the server, copying another client .app bundle from a file server on the same machine (using Finder or terminal using cp), occasionally causes the first client to disconnect. The client receives an EBROKENPIPE error when attempting to write to its socket.
In the Console, the following message appears just before the disconnection:
necp_socket_find_policy_match: Marking socket in state 258 as defunct
This issue seems to occur only when copying an .app bundle signed with the same TeamIdentifier as the running client. Copying arbitrary files or bundles with a different TeamIdentifier does not trigger the problem.
We are running on macOS 15.5. The issue appears specific to macOS 15 and was not observed on earlier versions.
Any help or pointers would be greatly appreciated!
Topic:
App & System Services
SubTopic:
Networking
Context
I'm working on a DNS proxy network extension and would like to be able to parse replies from the upstream DNS server for extracting the TTL for caching purposes.
I already have a working DNS proxy network extension, but at the moment I am not handling the responses and just forward all queries to an upstream DNS server.
My understanding is that I have to take care of result caching myself because I cannot use the system resolver in the DNS proxy network extension.
Question
What is the best way to parse DNS replies in Swift to extract e.g. the TTL?
I found an old thread (https://forums.swift.org/t/parse-dns-packet-requests-and-responses/41797/5) describing a way to achieve this using dns_util.
The solution described there works - but dns_parse_packet in dns_util have been marked deprecated since iOS 16.
So, I am wondering if there is a better way to achieve the parser.
I tried to utilize the dnssd framework but was unable to figure out how to achieve only parsing of the raw DNS reply. If that is possible it would be great to get some pointers.
I am trying to intercept localhost connections within NETransparentProxyProvider system extension. As per NENetworkRule documentation
If the address is a wildcard address (0.0.0.0 or ::) then the rule will match all destinations except for loopback (127.0.0.1 or ::1). To match loopback traffic set the address to the loopback address.
I tried to add
NWHostEndpoint *localhostv4 = [NWHostEndpoint endpointWithHostname:@"127.0.0.1" port:@""];
NENetworkRule *localhostv4Rule = [[NENetworkRule alloc] initWithDestinationNetwork:localhostv4 prefix:32 protocol:NENetworkRuleProtocolAny];
in the include network rules. I tried several variations of this rule like port 0, prefix 0 and some others. But the provider disregards the rule and the never receives any traffic going to localhost on any port.
Is there any other configuration required to receive localhost traffic in NETransparentProxyProvider?
We are a Layer 3 VPN provider offering a comprehensive SASE (Secure Access Service Edge) solution that includes TLS inspection, threat protection, granular access control, and secure access to private resources.
One of the key challenges we face involves TLS inspection. Many mobile applications, especially on iOS, implement certificate pinning, which causes them to fail when TLS inspection is applied. These apps expect connections to be secured with a specific certificate or trusted certificate authority, and inspection disrupts this trust model.
On iOS, the current limitation is that the Packet Tunnel Provider extension does not provide visibility into the originating application (i.e., there is no API to obtain the app’s bundle ID or package name associated with a given network connection). Due to this, we are unable to dynamically determine whether TLS inspection should be bypassed for a particular app.
While Apple’s Per-App VPN is one possible solution, it introduces a significant drawback: any applications that are excluded from the VPN configuration are entirely outside the VPN tunnel. This means they do not benefit from any of our SASE features — including secure access to internal resources, DNS/web content filtering, or threat detection. This limits the effectiveness of our solution in environments where both inspection and secure access are critical.
We would like to understand whether iOS has any current or planned capabilities to associate a network flow (e.g., a 5-tuple: source IP, destination IP, source port, destination port, and protocol) with the originating app. Such a capability would allow us to programmatically identify certificate-pinned apps and selectively disable TLS inspection without excluding them entirely from the VPN, thereby preserving the full set of SASE protections.
Is there any guidance or roadmap update from Apple that addresses this use case?
Our app is connected to a hardware wifi without network. Under normal circumstances, we can communicate with the device. At some point, the communication suddenly stops, and the ping prompts "No route to host". The only way to reconnect is to restart the device. It feels like the system has marked ARP. Is there any way to reconnect the device without restarting the device?
I'm new to Control Filter Extensions and have a question about their network capabilities. I'm building an app that processes network data and need to send some results to a remote server.
My main questions:
Are Control Filter Extensions officially permitted to make outbound UDP connections? I want to confirm this is a supported capability before implementing the network export functionality.
What specific entitlements are required for outbound network access? Currently using content-filter-provider - do I need additional network-related entitlements?
Are there any restrictions or considerations for UDP data export in production vs development builds?
I want to ensure I'm following Apple's guidelines and using the correct entitlements for this type of data export from a Control Filter Extension.
Any guidance on the official network capabilities and required setup would be greatly appreciated!
Our app uses NEVPNManager with IPsec to create VPN. It uses certificate authentication(.p12) and VPN connectivity is working as expected.
Now I am trying to apply On demand rules to manage this VPN.
let onDemandRule = NEOnDemandRuleConnect()
onDemandRule.interfaceTypeMatch = .wiFi
onDemandRule.ssidMatch = ["DNET"]
NEOnDemandRuleConnect with interfaceTypeMatch and ssidMatch is starting VPN when the rule matches.
When I add onDemandRule.dnsSearchDomainMatch = ["pa.test2.com"], it is not switching ON the VPN when I browse the "pa.test2.com" in the safari. I also tried *.test2.com and *.com. None of these domains switching ON the VPN.
Can you please help me if I am missing anything?
when i am running this app on Iphone13 facing these errors
On starting Publisher: failed(-11992: Wi-Fi Aware)
[L1 ready, local endpoint: , parameters: udp, traffic class: 700, interface: nan0, local: ::.0, definite, attribution: developer, server, port: 65041, path satisfied (Path is satisfied), interface: nan0[802.11], ipv4, uses wifi, LQM: unknown, service: com.example.apple-samplecode.Wi-FiAwareSample94KV3E626L._sat-fileservice._udp scope:0 route:0 custom:107]: waiting(POSIXErrorCode(rawValue: 50): Network is down)
[L1 cancelled, local endpoint: , parameters: udp, traffic class: 700, interface: nan0, local: ::.0, definite, attribution: developer, server, port: 65041, path , service: com.example.apple-samplecode.Wi-FiAwareSample94KV3E626L._sat-fileservice._udp scope:0 route:0 custom:107]: ready
[L1 cancelled, local endpoint: , parameters: udp, traffic class: 700, interface: nan0, local: ::.0, definite, attribution: developer, server, port: 65041, path , service: com.example.apple-samplecode.Wi-FiAwareSample94KV3E626L._sat-fileservice._udp scope:0 route:0 custom:107]: failed(-11992: Wi-Fi Aware)
OnStarting Subscriber : -11992: Wi-Fi Aware
B1 <nw_browse_descriptor application_service _sat-simulation._udp bundle_id=com.example.apple-samplecode.Wi-FiAwareSample94KV3E626L device_types=7f device_scope=ff custom:108>, generic, interface: nan0, multipath service: interactive, attribution: developer: failed(-11992: Wi-Fi Aware)
Hi,
I run a PacketTunnelProvider embedded within a system extension. We have been having success using this; however we have problems with accessing certificates/private keys manually imported in the file-based keychain.
As per this, we are explicitly targeting the file-based keychain.
However when attempting to access the certificate and private key we get the following error:
System error using certificate key from keychain: Error Domain=NSOSStatusErrorDomain Code=-25308 "CSSM Exception: -2147415840 CSSMERR_CSP_NO_USER_INTERACTION" (errKCInteractionNotAllowed / errSecInteractionNotAllowed: / Interaction is not allowed
As per the online documentation, I would expect to be prompted for the access to the application:
When an app attempts to access a keychain item for a particular purpose—like using a private key to sign a document—the system looks for an entry in the item’s ACL containing the operation. If there’s no entry that lists the operation, then the system denies access and it’s up to the calling app to try something else or to notify the user.
If there is an entry that lists the operation, the system checks whether the calling app is among the entry’s trusted apps. If so, the system grants access. Otherwise, the system prompts the user for confirmation. The user may choose to Deny, Allow, or Always Allow the access. In the latter case, the system adds the app to the list of trusted apps for that entry, enabling the app to gain access in the future without prompting the user again
But I do not see that prompt, and I only see the permission denied error in my program.
I can work around this one of two ways
Change the access control of the keychain item to Allow all applications to access this item. This is not preferable, as it essentially disables any ACLs for this item.
Embed the certificate in a configuration profile that is pushed down to the device via MDM or something similar. This works at a larger scale, but if I'm trying to manually test out a certificate, I don't always want to have to set this up.
Is there another way that I go about adding my application to the ACL of the keychain item?
Thanks!
Topic:
App & System Services
SubTopic:
Networking
Tags:
Network Extension
Security
System Extensions
Hello everyone, 👋🏼🤠
I've been struggling with a persistent issue for several weeks and would greatly appreciate any insights or suggestions from the community.
❗️Problem Summary
We are sending JSON requests (~100 KB in size) via URLSession from a Swift app running on Windows. These requests consistently time out after a while. Specifically, we receive the following error:
Error Domain=NSURLErrorDomain Code=-1001 "(null)"
This only occurs on Windows – under macOS and Linux, the same requests work perfectly.
🔍 Details
The server responds in under 5 seconds, and we have verified that the backend (a Vapor app in Kubernetes) is definitely not the bottleneck.
The request always hits the timeout interval, no matter how high we configure it: 60, 120, 300, 600 seconds – the error remains the same. (timeoutForRequest)
The request flow: Swift App (Windows)
---> HTTPS
---> Load Balancer (NGINX)
---> HTTP
---> Ingress Controller
---> Vapor App (Kubernetes)
On the load balancer we see this error: client prematurely closed connection, so upstream connection is closed too (104: Connection reset by peer)
The Ingress Controller never receives the complete body in these error cases. The content length set by the Swift app exceeds the data actually received.
We disabled request buffering in the Ingress Controller, but the issue persists.
We even tested a setup where we inserted a Caddy server in between to strip away TLS. The Swift app sent unencrypted HTTP requests to Caddy, which then forwarded them. This slightly improved stability but did not solve the issue.
🧪 Additional Notes
The URLSession is configured in an actor, with a nonisolated URLSession instance:
actor DataConnectActor {
nonisolated let session : URLSession = URLSession(configuration: {
let urlSessionConfiguration : URLSessionConfiguration = URLSessionConfiguration.default
urlSessionConfiguration.httpMaximumConnectionsPerHost = ProcessInfo.processInfo.environment["DATACONNECT_MAX_CONNECTIONS"]?.asInt() ?? 16
urlSessionConfiguration.timeoutIntervalForRequest = TimeInterval(ProcessInfo.processInfo.environment["DATACONNECT_REQUEST_TIMEOUT"]?.asInt() ?? 120)
urlSessionConfiguration.timeoutIntervalForResource = TimeInterval(ProcessInfo.processInfo.environment["DATACONNECT_RESSOURCE_TIMEOUT"]?.asInt() ?? 300)
urlSessionConfiguration.httpAdditionalHeaders = ["User-Agent": "DataConnect Agent (\(Environment.version))"]
return urlSessionConfiguration
}())
public internal(set) var accessToken: UUID? = nil
...
}
Requests are sent via a TaskGroup, limited to 5 concurrent tasks.
The more concurrent tasks we allow, the faster the timeout occurs.
We already increased the number of ephemeral ports in Windows. This made things slightly better, but the problem remains.
Using URLSessionDebugLibcurl=1 doesn't reveal any obvious issue related to libcurl.
We have also implemented a retry mechanism, but all retries also time out.
🔧 Request Flow (Code Snippet Summary)
let data = try JSONEncoder().encode(entries)
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.httpBody = data
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
request.setValue("application/json; charset=UTF-8", forHTTPHeaderField: "Content-Type")
// additional headers...
let (responseData, response) = try await urlSession.data(for: request)
✅ What We’ve Tried
Tested with and without TLS
Increased timeout and connection settings
Disabled buffering on Ingress
Increased ephemeral ports on Windows
Limited concurrent requests
Used URLSessionDebugLibcurl=1
We don't know how we can look any further here.
Thank you in advance for any guidance!
This is the log on the publisher side.
Publisher discovered the subscriber, but could not pair.
Follow up is sent with response rejected