Solved: dyld: Symbol not found: _OBJC_CLASS_$_NSURLSessionWebSocketMessage
This error was occurred when run the app on an iOS device with OS version less than 13, after investigate the problem was caused by the…
This error was occurred when run the app on an iOS device with OS version less than 13, after investigate the problem was caused by the ktor
library, I find when I added ktor
library to the application, the app will crash with the above error. And I try to downgrade the ktor, the latest version is 2.0.3
, and when I downgrade to 1.6.8
the application can run.
Another problem is send message to websocket with the following code:actual fun sendMessage(msg: String) {
val message = NSURLSessionWebSocketMessage(msg)
webSocket?.sendMessage(message) { err ->
err?.let { println("send $msg error: $it") }
}
}
In the method, it uses a class named NSURLSessionWebSocketMessage
, but from apple’s document, this class is available for iOS 13+
, so if there are code reference NSURLSessionWebSocketMessage
, it will report this error.