Our app supports live streaming (RTSP, RTMP, WebRTC) functionality.
After updating to the 18.5 Developer Beta version, we’ve encountered an issue where streaming over LTE is not working for customers using SKT (SK Telecom) as their carrier.
Upon investigation, it seems that a similar issue might be occurring with a streaming service app called "SOOP."
I would appreciate it if you could share any information regarding this bug.
Thank you.
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
Activity
I'm using NWBrowser to search for a server that I hosted. The browser does find my service but when it tries to connect to it, it gets stuck in the preparing phase in NWConnection.stateUpdateHandler. When I hardcode the local IP address of my computer (where the server is hosted) into NWConnection it works perfectly fine and is able to connect.
When it gets stuck in the preparing phase, it gives me the warnings and error messages in the image below. You can also see that the service name is correct and it is found.
I have tried _http._tcp and _ssh._tcp types and neither work.
This is what my code looks like:
func findServerAndConnect(port: UInt16) {
print("Searching for server...")
let browser = NWBrowser(for: .bonjour(type: "_ssh._tcp", domain: "local."), using: .tcp)
browser.browseResultsChangedHandler = { results, _ in
print("Found results: \(results)")
for result in results {
if case let NWEndpoint.service(name, type_, domain, interface) = result.endpoint {
if name == "PocketPadServer" {
print("Found service: \(name) of type \(type_) in domain \(domain) on interface \(interface)")
// Construct the full service name, including type and domain
let fullServiceName = "\(name).\(type_).\(domain)"
print("Full service name: \(fullServiceName), \(result.endpoint)")
self.connect(to: result.endpoint, port: port)
browser.cancel()
break
}
}
}
}
browser.start(queue: .main)
}
func connect(to endpoint: NWEndpoint, port: UInt16) {
print("Connecting to \(endpoint) on port \(port)...")
// endpoint = NWEndpoint(
let tcpParams = NWProtocolTCP.Options()
tcpParams.enableFastOpen = true
tcpParams.keepaliveIdle = 2
let params = NWParameters(tls: nil, tcp: tcpParams)
params.includePeerToPeer = true
// connection = NWConnection(host: NWEndpoint.Host("xx.xxx.xxx.xxx"), port: NWEndpoint.Port(3000), using: params)
connection = NWConnection(to: endpoint, using: params)
connection?.pathUpdateHandler = { path in
print("Connection path update: \(path)")
if path.status == .satisfied {
print("Connection path is satisfied")
} else {
print("Connection path is not satisfied: \(path.status)")
}
}
connection?.stateUpdateHandler = { newState in
DispatchQueue.main.async {
switch newState {
case .ready:
print("Connected to server")
self.pairing = true
self.receiveMessage()
case .failed(let error):
print("Connection failed: \(error)")
self.isConnected = false
case .waiting(let error):
print("Waiting for connection... \(error)")
self.isConnected = false
case .cancelled:
print("Connection cancelled")
self.isConnected = false
case .preparing:
print("Preparing connection...")
self.isConnected = false
default:
print("Connection state changed: \(newState)")
break
}
}
}
connection?.start(queue: .main)
}
Good day, this is a concept maybe newbie question… what would be the best approach to develop the real time app… what I want is to be able to connect one device to other one within the app, and for example, if the app has a draggable object, then if one user drags the object, the other user see the object moving in real time I his own device, maybe using a ghost mode when interacting… this way both users using the app can interact with the objects in real-time. It’s not a game, so there’s no score… could I use gamecenter? or multipeer connectivity over BT? Is there a native framework?
wich would be the easiest and less battery and system consuming approach someone could suggest?
thank you in advance….
Topic:
App & System Services
SubTopic:
Networking
My laptop (M1 Pro, macOS 15.3.2) is connected to a dual stack network via Wi-Fi. The home.arpa. domain is supplied as a search domain via both DHCPv4 (options 15 and 119) and DHCPv6 (option 24). "Details…" for the network connection in System Settings show this domain under the DNS tab.
The laptop uses a Forwarding DNS Resolver of my router, which in turn forwards requests for home.arpa. (including subdomains) to a local DNS server (CoreDNS) which is authoritative for this zone.
The DNS server is configured via the following zone file:
$ORIGIN home.arpa.
$TTL 3600
@ IN SOA @ nobody.invalid. (1 3600 1200 604800 3600)
@ NS @
@ AAAA ….1
gateway A ….1
gateway AAAA …::1
b._dns-sd._udp PTR @
lb._dns-sd._udp PTR @
db._dns-sd._udp PTR @
_services._dns-sd._udp PTR _smb._tcp
_smb._tcp PTR Media._smb._tcp
Media._smb._tcp SRV 0 0 445 gateway
Media._smb._tcp TXT ("path=/media" "u=guest")
Output of dig(1) looks like:
$ dig @….1 -t PTR lb._dns-sd._udp.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43291
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;lb._dns-sd._udp.home.arpa. IN PTR
;; ANSWER SECTION:
lb._dns-sd._udp.home.arpa. 1993 IN PTR home.arpa.
;; AUTHORITY SECTION:
home.arpa. 2771 IN NS home.arpa.
$ dig @….1 -t PTR _services._dns-sd._udp.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9057
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;_services._dns-sd._udp.home.arpa. IN PTR
;; ANSWER SECTION:
_services._dns-sd._udp.home.arpa. 3600 IN PTR _smb._tcp.home.arpa.
;; AUTHORITY SECTION:
home.arpa. 3600 IN NS home.arpa.
$ dig @….1 -t PTR _smb._tcp.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44220
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;_smb._tcp.home.arpa. IN PTR
;; ANSWER SECTION:
_smb._tcp.home.arpa. 3599 IN PTR Media._smb._tcp.home.arpa.
;; AUTHORITY SECTION:
home.arpa. 3599 IN NS home.arpa.
$ dig @….1 -t SRV Media._smb._tcp.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45878
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;Media._smb._tcp.home.arpa. IN SRV
;; ANSWER SECTION:
media._smb._tcp.home.arpa. 3600 IN SRV 0 0 445 gateway.home.arpa.
;; AUTHORITY SECTION:
home.arpa. 3600 IN NS home.arpa.
$ dig @….1 -t A gateway.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2782
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;gateway.home.arpa. IN A
;; ANSWER SECTION:
gateway.home.arpa. 86400 IN A 192.168.99.1
;; AUTHORITY SECTION:
home.arpa. 3578 IN NS home.arpa.
$ dig @….1 -t AAAA gateway.home.arpa.
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17297
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;gateway.home.arpa. IN AAAA
;; ANSWER SECTION:
gateway.home.arpa. 3600 IN AAAA fd6f:9784:5753::1
;; AUTHORITY SECTION:
home.arpa. 3600 IN NS home.arpa.
Output of dns-sd(1):
/usr/bin/dns-sd -test
…
Testing for error returns when various strings are > 63 bytes: PASSED
Running basic API input range tests with various pointer parameters set to NULL:
Basic API input range tests: PASSED
$ dns-sd -m -F
Looking for recommended browsing domains:
DATE: ---Fri 11 Apr 2025---
8:50:17.846 ...STARTING...
Timestamp Recommended Browsing domain
8:50:17.847 Added (More) local
8:50:17.847 Added arpa
- > home
$ dns-sd -B _smb._tcp home.arpa.
Browsing for _smb._tcp.home.arpa.
DATE: ---Fri 11 Apr 2025---
8:59:10.044 ...STARTING...
$ dns-sd -L Media _smb._tcp home.arpa.
Lookup Media._smb._tcp.home.arpa.
DATE: ---Fri 11 Apr 2025---
9:15:53.328 ...STARTING...
$ dns-sd -Q _smb._tcp.home.arpa. PTR IN
DATE: ---Fri 11 Apr 2025---
9:16:52.208 ...STARTING...
Timestamp A/R Flags IF Name Type Class Rdata
9:16:52.210 Add 40000002 0 _smb._tcp.home.arpa. PTR IN 0.0.0.0 No Such Record
9:16:52.222 Add 2 0 _smb._tcp.home.arpa. PTR IN 0.0.0.0 No Such Record
Similarly, when I open Finder->Network I see home.arpa but it's empty. Of interest is that on the DNS server side I see the following requests being made:
2025-04-11 09:03:15 container,info,debug [INFO] […]:56541 - 21555 "SOA IN _afpovertcp._tcp.home.arpa. udp 44 false 512" NXDOMAIN qr,aa,rd 112 0.000755089s
2025-04-11 09:03:15 container,info,debug [INFO] […]:56077 - 58266 "SOA IN _smb._tcp.home.arpa. udp 37 false 512" NOERROR qr,aa,rd 105 0.001012632s
2025-04-11 09:03:15 container,info,debug [INFO] […]:45274 - 45976 "SOA IN _rfb._tcp.home.arpa. udp 37 false 512" NXDOMAIN qr,aa,rd 105 0.000762339s
2025-04-11 09:03:15 container,info,debug [INFO] […]:54387 - 32090 "SOA IN _adisk._tcp.home.arpa. udp 39 false 512" NXDOMAIN qr,aa,rd 107 0.001058132s
2025-04-11 09:03:15 container,info,debug [INFO] […]:35855 - 51155 "SOA IN _tcp.home.arpa. udp 32 false 512" NOERROR qr,aa,rd 100 0.000664963s
I suppose that an attempt to locate services is made but it's unsuccessful and I'm not sure why.
What further debugging can I attempt?
Hi,
Having an issue on one mac using Xcode 16.3 and simulator 18.4. macSO 15.4
We are checking for bonjour:
authorizationBrowser = NWBrowser(for: .bonjour(type: "_bonjour._tcp", domain: nil), using: parameters)
authorizationBrowser?.stateUpdateHandler = { [weak self] newState in
switch newState {
...
}
}
However at the command line we get the error:
nw_browser_fail_on_dns_error_locked [B1] nw_browser_dns_service_browse_callback failed: PolicyDenied(-65570)
Any idea why this is happening? or what this error means?
Thanks Antz
Hi everyone,
I'm developing an enterprise iOS application and need to access the WiFi connection channel. I understand that Apple's privacy and security policies restrict direct access to certain network details, including the WiFi connection channel.
After some research, I found that this data might be accessible via the private API MobileWiFi.framework. However, when I tried to use this framework, I encountered the following error:
Missing com.apple.wifi.manager-access entitlement
I reached out to Apple regarding this entitlement, but they were not familiar with it, suggesting it might be deprecated.
Here are my questions:
Is there an official or supported way to access the WiFi connection channel in an enterprise iOS app?
If not, is there any workaround or additional steps required to use the MobileWiFi.framework without encountering the entitlement error?
Are there any specific entitlements or provisioning profile configurations that I need to be aware of to resolve this issue?
Any guidance or suggestions would be greatly appreciated. Thank you!
Hi Dev Forums and Quinn "The Eskimo!",
Short version
Is there sample NWConnection code available that behaves in a similar way to the higher level URLSession and URLRequest APIs?
Long version
I have not been able to make this question get past the "sensitive language filter" on the dev forums. I figured it might be 'fool' or 'heck', or the X link, but removing each of those still triggers the sensitive language filter.
Please see this gist:
https://gist.github.com/lzell/8672c26ecb6ee1bb26d3aa3c7d67dd62
Thank you!
Lou Zell
iOS 18.4 introduced some requirements on the Key Usage of 802.1x server certificates, as described here. https://support.apple.com/en-us/121158
When using TLS_ECDHE_RSA or TLS_DHE_RSA cipher suites, 802.1X server certificates containing a Key Usage extension must have Digital Signature key usage set.
When using the TLS_RSA cipher suite, 802.1X server certificates containing a Key Usage extension must have Key Encipherment key usage set.
It reads like the change is supposed to affect 802.1x only. However, we have found out that the new restrictions are actually imposed on all TLS connections using the Network framework, including in Safari.
Unlike other certificate errors which can be either ignored by users (as in Safari) or by code (via sec_protocol_options_set_verify_block), these new ones can't. Even if passing completion(true) in the TLS verification block, the connection still ends up in waiting state with error -9830: illegal parameter.
I understand that these requirements are valid ones but as a generic TLS library I also expect that Network framework could at least allow overriding the behavior. The current treatment is not consistent with those on other certificate errors.
Since I can't upload certificates, here is how to reproduce a certificate that fails.
Create a OpenSSL config file test.cnf
[ req ]
default_bits = 2048
distinguished_name = dn
x509_extensions = v3_ca
prompt = no
[ dn ]
CN = example.com
[ v3_ca ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = CA:TRUE
keyUsage = critical, keyCertSign, cRLSign
Generate certificate and private key
openssl req -x509 -new -nodes -keyout key.pem -out cert.pem -days 365 -config test.cnf
And here is the client code to test.
// Target server and port
let host = NWEndpoint.Host("example.com")
let port = NWEndpoint.Port("443")!
// Configure insecure TLS options
let tlsOptions = NWProtocolTLS.Options()
sec_protocol_options_set_verify_block(tlsOptions.securityProtocolOptions, { _, _, completion in
// Always trust
completion(true)
}, DispatchQueue.global())
let params = NWParameters(tls: tlsOptions)
let connection = NWConnection(host: .init(host), port: .init(rawValue: port)!, using: params)
connection.stateUpdateHandler = { newState in
switch newState {
case .ready:
print("TLS connection established")
case .failed(let error):
print("Connection failed: \(error)")
case .cancelled:
print("Connection canceled")
case .preparing:
print("Connection preparing")
case .waiting(let error):
print("Connection waiting: \(error)")
case .setup:
print("Connection setup")
default:
break
}
}
connection.start(queue: .global())
Output
Connection preparing
Connection waiting: -9830: illegal parameter
Previously reported as FB17099740
So it seems the NetworkFramework is still not able to support Broastcast Mode am I correct?
As soon as I switch broadcast mode to On in my game I receive console messages instead of receiving data.
nw_path_evaluator_create_flow_inner failed NECP_CLIENT_ACTION_ADD_FLOW (null) evaluator parameters: udp, definite, server, attribution: developer, reuse local address, context: Default Network Context (private), proc: 2702288D-96FB-37DD-8610-A68CC526EA0F, local address: 0.0.0.0:20778
nw_path_evaluator_create_flow_inner NECP_CLIENT_ACTION_ADD_FLOW 1FB68D7E-7C9B-47B2-B6AC-E5710CD9C9CD [17: File exists]
nw_endpoint_flow_setup_channel [C2 192.168.178.221:52716 initial channel-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, ipv6, dns, uses wifi)] failed to request add nexus flow
nw_endpoint_flow_failed_with_error [C2 192.168.178.221:52716 initial channel-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, ipv6, dns, uses wifi)] already failing, returning
nw_endpoint_handler_create_from_protocol_listener [C2 192.168.178.221:52716 failed channel-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, ipv6, dns, uses wifi)] nw_endpoint_flow_pre_attach_protocols
nw_connection_create_from_protocol_on_nw_queue [C2] Failed to create connection from listener
nw_ip_channel_inbox_handle_new_flow nw_connection_create_from_protocol_on_nw_queue failed
I won't be able to receive data which is a real shame, so I guess I am stuck with the lower level code:
// Enable broadcast
var enableBroadcast: Int32 = 1
if setsockopt(socketDescriptor, SOL_SOCKET, SO_BROADCAST, &enableBroadcast, socklen_t(MemoryLayout<Int32>.size)) == -1 {
let errorMessage = String(cString: strerror(errno))
throw UDPSocketError.cannotEnableBroadcast(errorMessage)
}
I am seeking assistance with how to properly handle / save / reuse NWConnections when it comes to the NWBrowser vs NWListener.
Let me give some context surrounding why I am trying to do what I am.
I am building an iOS app that has peer to peer functionality. The design is for a user (for our example the user is Bob) to have N number of devices that have my app installed on it. All these devices are near each other or on the same wifi network. As such I want all the devices to be able to discover each other and automatically connect to each other. For example if Bob had three devices (A, B, C) then A discovers B and C and has a connection to each, B discovers B and C and has a connection to each and finally C discovers A and B and has a connection to each.
In the app there is a concept of a leader and a follower. A leader device issues commands to the follower devices. A follower device just waits for commands. For our example device A is the leader and devices B and C are followers. Any follower device can opt to become a leader. So if Bob taps the “become leader” button on device B - device B sends out a message to all the devices it’s connected to telling them it is becoming the new leader. Device B doesn’t need to do anything but device A needs to set itself as a follower. This detail is to show my need to have everyone connected to everyone.
Please note that I am using .includePeerToPeer = true in my NWParameters. I am using http/3 and QUIC. I am using P12 identity for TLS1.3. I am successfully able to verify certs in sec_protocal_options_set_verify_block. I am able to establish connections - both from the NWBrowser and from NWListener. My issue is that it’s flaky. I found that I have to put a 3 second delay prior to establishing a connection to a peer found by the NWBrowser. I also opted to not save the incoming connection from NWListener. I only save the connection I created from the peer I found in NWBrowser. For this example there is Device X and Device Y. Device X discovers device Y and connects to it and saves the connection. Device Y discovers device X and connects to it and saves the connection. When things work they work great - I am able to send messages back and forth. Device X uses the saved connection to send a message to device Y and device Y uses the saved connection to send a message to device X.
Now here come the questions.
Do I save the connection I create from the peer I discovered from the NWBrowser?
Do I save the connection I get from my NWListener via newConnectionHandler?
And when I save a connection (be it from NWBrowser or NWListener) am I able to reuse it to send data over (ie “i am the new leader command”)?
When my NWBrowser discovers a peer, should I be able to build a connection and connect to it immediately?
I know if I save the connection I create from the peer I discover I am able to send messages with it. I know if I save the connection from NWListener - I am NOT able to send messages with it — but should I be able to?
I have a deterministic algorithm for who makes a connection to who. Each device has an ID - it is a UUID I generate when the app loads - I store it in UserDefaults and the next time I try and fetch it so I’m not generating new UUIDs all the time. I set this deviceID as the name of the NWListener.Service I create. As a result the peer a NWBrowser discovers has the deviceID set as its name. Due to this the NWBrowser is able to determine if it should try and connect to the peer or if it should not because the discovered peer is going to try and connect to it.
So the algorithm above would be great if I could save and use the connection from NWListener to send messages over.
Our enterprise product uses a content filter, normally customers deploy MDM profiles to authorise and allow the content filter to work.
Some customers however do not use these profiles, requiring them to enable the system extension in System Settings and allow the content filter via the popup below.
If the user selects "Don't Allow", intentionally or by mistake, there does not appear to be an mechanism for them to change their mind and allow it instead.
If the user fails to enable the system extension on the first prompt, there is an option to enable if via System Settings. There doesn't seem to be a similar option if they "Don't Allow" the content filter.
How can the user allow a previously denied content filter?
Topic:
App & System Services
SubTopic:
Networking
Tags:
Extensions
System Extensions
Network Extension
I'm establishing a connection with NWListener and NWConnection which is working great. However, if the listener disappears, a lot of logs are appearing:
Is there a way to hide these logs?
I'm aware of OS_ACTIVITY_MODE=disabled, but that will also hide a lot of other logs.
I also know you can hide these using Xcode's filtering. I'm looking for a programmatically way to hide these completely. I'm not interested in seeing these at all, or, at least, I want to be in control.
Thanks!
We are currently working on a zero-configuration networking compliant device thru avahi-daemon.
Our Device want to have multiple Instance name for different services.
Example
InstanceA._ipps._tcp.local.
InstanceA._ipp._tcp.local.
InstanceB._ipps._tcp.local.
InstanceB._ipp._tcp.local.
Will BCT confuse this as multiple device connected in the network and cause it to fail? Does Bonjour only allows only a Single Instance name with multiple services?
Hello,
Recently I am trying to add stub dns server to my Network Extension (a VPN app), after some research on this forum, and since my language is C, I have the following plan:
create a udp socket which use setsockopt(IP_BOUND_IF) to bound the socket to the utun if index obtained, and also bind to the address of the utun address I set(let's say 192.168.99.2), then listen on the udp port 53 which is ready to handle dns request.
configure the dns server to 192.168.99.2 in the provider's Network Settings, thus iOS system will send udp query to the udp socket created in step 1, and it can then do some split dns function such as resolve using local interface (cellular or wifi), or some nameserve which will be routed to the VPN tunnel (will create new UDP socket and do IP_BOUND_IF to ensure the traffic will enter the VPN tunnel), and the result should be return to the system and then the non VPP apps.
But I observer weird issue, indeed I can get the system send the dns request to the listening udp socket and I can get the result write to the system(address like 192.168.99.2:56144, the port should be allocated by the iOS system's DNS component) without any failure(I did get some error before due to I using the wrong utun if index, but fixed it later), but it seems non VPN app like browser can't get the resolved ip for domains.
I want to ask is this limited by the sandbox? or any special sock opt I need to do.
Thanks.
PS:
in the provider's network settings, all the system's traffic will be point to the utun, which means the VPN process will process all the traffic.
the reason I do not set the dns server to utun peers side which is my userspace networking stack's ip (192.168.99.1) is the stack is not be able to leverage some dns libraries due to architecture issue. (it's fd.io vpp which we ported to apple platform).
On an iOS 18 device, after installing the application and initially denying local network permission when prompted, manually enabling this permission in the system settings does not resolve the issue. After uninstalling and reinstalling the app, although local network access is granted, the app cannot discover smart hardware devices over the local area network (LAN) or proceed with configuration. The smart hardware sends configuration data packets over the LAN, but the app fails to receive these packets. This issue persists even after another uninstall and reinstall of the app. However, rebooting the device restores normal functionality.
Steps to Reproduce:
Install the application on an iOS 18 device.
Upon first launch, deny the request for local network permissions.
Manually enable local network permissions via "Settings" > [App Name].
Uninstall and then reinstall the application.
Attempt to discover and configure smart hardware devices using the app. Notice that the app fails to receive configuration data packets sent by the smart hardware over the LAN.
Expected Result:
The application should be able to normally receive configuration data packets from smart hardware devices over the LAN and successfully complete the configuration process after obtaining local network permissions.
Actual Result:
Even after being granted local network permissions, the application cannot discover devices or receive configuration data packets over the LAN unless the iPhone device is rebooted. (reinstall app and obtaining local network permissions is not work too.)
Hello! 👋
I am noticing new failures in the iOS 18.5 Developer Beta build (22EF5042g) when calling the system call connect() (from C++ source, in network extension).
When using cell/mobile data (Mint & T-Mobile) this returns with EINTR (interrupted system call) right away. When I switch over to wifi, everything works fine.
Note: I have not tested on other mobile carriers; which could make a difference since T-Mobile/Mint are IPv6 networks.
FWIW, this is working in the previous developer beta (18.4).
Anyone have any ideas?
I am trying to make http3 client with Network.framework on Apple platforms.
Codes that implement NWConnectionGroup.start with NWListener don't always work with warning below.
I assume NWConnectionGroup.newConnectionHandler or NWListener.newConnectionHandler will be called to start connection from the server if it works.
nw_protocol_instance_add_new_flow [C1.1.1:2] No listener registered, cannot accept new flow
quic_stream_add_new_flow [C1.1.1:2] [-fde1594b83caa9b7] failed to create new stream for received stream id 3
so I tried:
create the NWListener -> not work
check whether NWConnectionGroup has a member to register or not NWListener -> not work (it doesn't have).
use NWConnection instead of NWConnectionGroup -> not work
Is my understanding correct?
How should I do to set or associate listener with NWConnection/Group for newConnectionHandler is called and to delete wanings?
What is the best practice in the case?
Sample codes are below.
Thanks in advance.
// http3 needs unidirectional stream by the server and client.
// listener
private let _listener: NWListener
let option: NWProtocolQUIC.Options = .init(alpn:["h3"])
let param: NWParameters = .init(quic: option)
_listener = try! .init(using: param)
_listener.stateUpdateHandler = { state in
print("listener state: \(state)")
}
_listener.newConnectionHandler = { newConnection in
print("new connection added")
}
_listener.serviceRegistrationUpdateHandler = { registrationState in
print("connection registrationstate")
}
// create connection
private let _group: NWConnectionGroup
let options: NWProtocolQUIC.Options = .init(alpn: ["h3"])
options.direction = .unidirectional
options.isDatagram = false
options.maxDatagramFrameSize = 65535
sec_protocol_options_set_verify_block(options.securityProtocolOptions, {(_: sec_protocol_metadata_t, _: sec_trust_t, completion: @escaping sec_protocol_verify_complete_t) in
print("cert completion.")
completion(true)
}, .global())
let params: NWParameters = .init(quic: options)
let group: NWMultiplexGroup = .init(
to: .hostPort(host: NWEndpoint.Host("google.com"),
port: NWEndpoint.Port(String(443))!))
_group = .init(with: group, using: params)
_group.setReceiveHandler {message,content,isComplete in
print("receive: \(message)")
}
_group.newConnectionHandler = {newConnection in
print("newConnectionHandler: \(newConnection.state)")
}
_group.stateUpdateHandler = { state in
print("state: \(state)")
}
_group.start(queue: .global())
_listener.start(queue: .global())
if let conn = _group.extract() {
let data: Data = .init()
let _ = _group.reinsert(connection: conn)
conn.send(content: data, completion: .idempotent)
}
Hi there!
We are working on our SkyElectric App which is being developed in Flutter framework, where we need user to connect with the Wifi of the the inverter.
We are trying to direct user to WiFi Settings page of the iOS in general settings where all the available WiFi Networks are listed but unfortunately user is being directed to App's Settings page.
We are using package of app_settings and launcher.
I've read that Apple changed a policy in 2019 where it restricts Apps to navigate to OS pages.
Question: Could you please verify if I APPLE allows us to access the General Settings or WiFi Settings through clicking a button in our App name "Open WiFi Settings", If not then Why?
I am making a USB attached IoT device that follows the Matter approach to connectivity (IP/mDNS/DHCP). I am having conflicts with it as it appears to MacOS as an Ethernet adapter and this is causing it to be assigned as a "default" route, interfering with routing when my Mac is connected to NAT based WiFi.
I'd like to be able to hint to MacOS & iPadOS that this is not a routable private network, the subnet should be respected and a default route should not be assigned to it, otherwise the order of the device connection is used by the IP routing tables and I am concerned my non-routable private network will initialize before Wifi and block NAT based internet connectivity.
How can I hint to MacOS/iPadOS "this is not a routable private network, this is not a NAT, do not assign me a default route beyond the subnet I have provided you."
I don't understand what permissions need to be given for this code to operate. I cannot seem to work out why I'm not able to see a BSSID.
I think I've given sandbox the appropriate permissions AND I've added some to the Target Properties for good measure. Yet, cannot get BSSID.
import SwiftUI
import CoreWLAN
import CoreLocation
struct ContentView: View {
@State private var currentBSSID: String = "Loading..."
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Current BSSID:")
Text(currentBSSID)
}
.padding()
.onAppear(perform: fetchBSSID)
}
func fetchBSSID() {
if let iface2 = CWWiFiClient.shared().interface() {
print("✅ Found Wi-Fi interface: \(iface2.interfaceName ?? "nil")")
} else {
print("❌ No Wi-Fi interface found")
}
if let iface = CWWiFiClient.shared().interface(),
let bssid = iface.bssid() {
currentBSSID = bssid
} else {
currentBSSID = "Not connected"
print("✅ BSSID: \(currentBSSID)")
}
}
}
#Preview {
ContentView()
}
Output - WifI interface is found but BSSID is not found.