Hello. I am currently struggling with another issue regarding Kotlin MPP.
I am unable to successfully execute a request using Ktor on iOS. It always throws an InvalidMutabilityException. I have a vague understanding of the mutability aspect, but can't figure out why it's being thrown on Ktor.
From iOS
Copy code
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen io.ktor.client.request.HttpRequestPipeline@3f59548
I've tried downgrading to Kotlin 1.3.10, as that seemed to be suggested on SO. However, it still throws the same exception.
Kotlin 1.3.11/10
Ktor 1.1.1
Coroutines 1.1.0
a
Ashley Figueira
01/22/2019, 10:40 PM
I had the same issue. Downgrading to kotlin 1.3.10 worked for me. Although i was using Ktor 1.0.1 and Coroutines 1.0.1 also.
p
Patrick Jackson
03/13/2019, 5:48 PM
@Drew did you resolve this? also seeing this with kotlin 1.3.21 ktor 1.1.3 coroutines 1.1.1
d
Drew
03/23/2019, 4:24 PM
@Patrick Jackson I think I did figure it out on my end. I believe it was because my Ktor client was being held in a global object
Drew
03/23/2019, 4:24 PM
Aka static, so couldn't be shared/mutated across threads
p
Patrick Jackson
03/29/2019, 1:34 PM
in my case I was not using the mainthread on iOS. I had to switch to using a CoroutineDispatcher that dispatches everything on the main queue.