NWTXTRecord dictionary keys are lowercased in iOS 17, on iOS Simulator and the device.
Records returned by NWBrowser in the listener block:
browser.browseResultsChangedHandler = { result, changes in
metadata : ["dvty": “AppName”, "txtvers": "1", "dbid": "50BFB79F"]
But the actual keys are: "DvTy", "DbId".
So, in iOS 17 all keys were lowercased, but not in any previous versions. And if in the app we were looking for “DvTy” key, nil is returned. The existing app simply stopped working properly in the first iOS 17 betas.
Is it a bug or the app should be updated now to check for lowercased keys always?
FB12309561
Post
Replies
Boosts
Views
Activity
Is it possible to have a submenu with .multicolor rendered icon? It works for Menu itself, but not for submenu.
It also works fine in UIKit with UIMenu as a submenu.
var body: some View {
Menu {
Menu {
Text("test")
} label: {
Label {
Text("Color Label submenu")
} icon: {
Image(systemName: "circle.hexagongrid.fill")
.symbolRenderingMode(.multicolor)
}
}
} label: {
Label {
Text("Color Label")
} icon: {
Image(systemName: "circle.hexagongrid.fill")
.symbolRenderingMode(.multicolor)
}
}
}
}
In TicTacToe example two modifications were added:
txtRecordObject was added to the listener:
listener.service?.txtRecordObject = NWTXTRecord(["key1": "value1"])
2. browser.browseResultsChangedHandler was updated with code to get the txt record:
browser.browseResultsChangedHandler = { results, changes in
results.forEach { device in
switch device.metadata {
case .bonjour(let record):
print(record)
case .none:
print("none")
default:
break
}
}
self.delegate?.refreshResults(results: results)
}
With the help of Discovery.app I can see that tictactoe service with the txt record ("key1=value1") was successfully published, but NWBrowser returns .none for metadata instead of the TXT record object.
How can I get the TXT record from the published Bonjour service?
URLSession streamTask with NetService crashes in iOS 14 beta.
func netService(_ sender: NetService, didUpdateTXTRecord data: Data) {
						let session = URLSession(configuration: .default, delegate: self, delegateQueue: nil)
						let streamTask = session.streamTask(with: sender)
						streamTask.resume()
						streamTask.captureStreams()
}
[NSNetService _internalNetService]: unrecognized selector sent to instance 0x600001ed5c40** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNetService _internalNetService]: unrecognized selector sent to instance 0x600001ed5c40'
but this one works fine:
let streamTask = session.streamTask(withHostName: sender.hostName!, port: sender.port)
FB8026131