https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
t

Tobi

10/08/2020, 2:28 PM
I could figure that one out and and have a working prototype for Android 💯 On iOS I am running into a
Thread 1: EXC_BAD_ACCESS (code=1, address=0x5fff89815c80)
, somewhere in the ktor coroutines stack. My code so far is fairly simple:
Copy code
class DoSomeWork(
    private val domainUrl: String,
    private val ktorClient: HttpClient,
    private val onResponse: (Response) -> Unit = {_ ->}
) {
    private val scope = MainScope()

    operator fun invoke() {
        scope.launch {
            val response: Response = <http://ktorClient.post|ktorClient.post>(domainUrl) {
               // . . .
            }

            onResponse(response)
        }
    }

    companion object {
        val json = Json {
            encodeDefaults = false
            ignoreUnknownKeys = true
        }
    }
}
Any idea what could be the reason?