Hello,
I think that I found a bug with NWBrowser and I'd like to ask you can fix this.
Problem
NWBrowser
does not return the result to the app, while NetServiceBrowser
returns.
- Problem occurs when using only Meross device, in other Matter device cases, both api works fine.
- Actually I want to get TXT Record from Meross, but failed with
NWBrowser
Steps
- Add Meross plug device (Matter, Wi-Fi device) to Apple Home app
- Turn On Pairing Mode of Meross device
- When I try to discover it with
NWBrowser
> it is NOT discovered (withNetServiceBrowser
> it is discovered)
Results
When I use NWBrowser
, I can't get any result from the handler.
On the other hand, with NetServiceBrowser
, I can get a result.
When I capture the packets with WireShark, the packets are same on both cases
- Case1: with
NWBrowser
- Case2: with
NetServiceBrowser
With same packets, Case1 does not return any result and Case2 returns results.
I'm trying to attaching the WireShark capture file and iOS console logs, but it continuosly fails. Please let me know how I can send them.
Code
Her is my code.
- NWBrowser
let bonjourWithTXT = NWBrowser.Descriptor.bonjourWithTXTRecord(type: "_matterc._udp.", domain: "local.")
let params = NWParameters.init()
self.nwBrowser = NWBrowser(for: bonjourWithTXT, using: params)
self.nwBrowser?.browseResultsChangedHandler = { [weak self] results, changes in
// Can not get any results here //
}
self.nwBrowser?.start(queue: .main)
- NetServiceBrowser
self.bonjourBrowser = NetServiceBrowser()
self.bonjourBrowser?.delegate = self
self.bonjourBrowser?.searchForServices(ofType: "_matterc._udp.", inDomain: "local.")
func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) {
service.delegate = self
service.resolve(withTimeout: resolutionTimeout)
netService.insert(service)
}
func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) {
netServices.remove(service)
}
func netServiceDidResolveAddress(_ service: NetService) {
// I can get found services here //
}