It works in iOS 17.1 using asynchronous code
let extPanIdHex = "yourExtPanId"
if let extPadIdData = Data(hexString: extPanIdHex)
{
let thClient = THClient()
Task
{
let credentials = try await thClient.credentials(forExtendedPANID: extPadIdData)
}
}
Sinchronous code still has some problems
This one doesn't work
let thClient = THClient()
thClient.retrieveCredentials(forExtendedPANID: extPadIdData) { credentials, error in
NSLog("")
}
Returned error
Client: -[THClient retrievePreferredCredentials:]_block_invoke - Error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 396 named com.apple.ThreadNetwork.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 396 named com.apple.ThreadNetwork.xpc was invalidated from this process.}
But this one oddly works
let thClient = THClient()
thClient.retrieveCredentials(forExtendedPANID: extPadIdData) { credentials, error in
let c = thClient
NSLog("")
}