Jarroyoesp
09/24/2020, 3:42 PMkotlinVersion = "1.4.0"
ktorVersion = "1.4.0"
coroutineVersion = "1.3.9-native-mt-2"
serializerVersion = "1.0.0-RC"
internal actual val ApplicationDispatcher: CoroutineContext =
NsQueueDispatcher(dispatch_get_main_queue())
internal class NsQueueDispatcher(
private val dispatchQueue: dispatch_queue_t
) : CoroutineDispatcher() {
override fun dispatch(context: CoroutineContext, block: Runnable) {
dispatch_async(dispatchQueue) {
block.run()
}
}
}
But when I try to create HttpClient this exception is thrown(kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.ChildHandleNode
):
private val client by lazy {
HttpClient() {
install(JsonFeature) {
serializer = KotlinxSerializer(nonStrictJson)
}
install(Logging) {
logger = Logger.DEFAULT
level = <http://LogLevel.INFO|LogLevel.INFO>
}
}
}
Has anyone had the same problem? Thanks in advance.ribesg
09/25/2020, 9:27 AMDispatchers.Main
and Dispatchers.Default
rather than custom dispatchers, now that they are available and workJarroyoesp
09/27/2020, 9:00 AMkotlinVersion = "1.4.10"
ktorVersion = "1.4.1"
coroutineVersion = "1.3.9-native-mt-2"
serializerVersion = "1.0.0-RC2"
But now in iOS side when HttpClient calls get() method this exception is thrown:
kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.