. Advertisement .
..3..
. Advertisement .
..4..
In the process of completing my work, I encountered the following problem:
Strange error nw_protocol_get_quic_image_block_invoke dlopen libquic failed
Below is the code I ran:
var readStream: Unmanaged<CFReadStream>?
var writeStream: Unmanaged<CFWriteStream>?
let host: CFString = NSString(string: hostIP)
let port: UInt32 = UInt32(self.VNCport)
self.password = password
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, host, port, &readStream, &writeStream)
inputStream = readStream!.takeRetainedValue()
outputStream = writeStream!.takeRetainedValue()
if readStream == nil {
print("Erro read")
}
if writeStream == nil {
print("Erro write")
}
inputStream!.delegate = self
outputStream!.delegate = self
inputStream!.schedule(in: RunLoop.main, forMode: RunLoop.Mode.default)
outputStream!.schedule(in: RunLoop.main, forMode: RunLoop.Mode.default)
inputStream!.open()
outputStream!.open()
What’s causing it, and how can it be resolved in the “nw_protocol_get_quic_image_block_invoke dlopen libquic failed“ in the swift?
The same error occurred in a different context in XCode 12.0.1. Although it may not be related, I suspect that the issue is with accessing the main thread’s run loop. This is not a problem with your code, but a bug I encountered while trying to use some online introductory code. Here are some ways you can find a piece that has the same problem:
However, this was possible because I rewrote the code. Perhaps you will find the solution to your problem in the code below.
In particular, you can use the following
DispatchQueue.global
insteadThis error is not happening anymore when I use
URLSession.shared.dataTask
I ran across the same problem in a Widget Target, but it was solved when I added “public” to the variables.
The program after fixing is: