https://kotlinlang.org logo
#ktor
Title
# ktor
r

Rodrigo Munera

10/12/2023, 3:12 PM
I'm trying to follow this guide with a new KMP project and I'm having some issues with my iosApp, (androidApp works as expected). When I run the iOS simulator with the app it crashes with the following error
Copy code
HttpClient: REQUEST https://<mystagingserver>/auth_token failed with exception: kotlin.IllegalStateException: TLS sessions are not supported on Native platform.
Function doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
It is considered unexpected and unhandled instead. Program will be terminated.
These are the sourcesets I've set up in my build.gradle.kts file under my shared folder. What am I missing? I added my okhttp dependency for the android project in the separate gradle build file under that module so that side works fine
e

e5l

10/12/2023, 3:14 PM
Hey, @Rodrigo Munera, thanks for the question! Could you try moving
libs.ktor.client.cio
to the
jvmMain
source set ?
👀 1
r

Rodrigo Munera

10/12/2023, 3:15 PM
I'll try that. there isn't a sourceset defined for it but I'll create it
e

e5l

10/12/2023, 3:16 PM
if you don’t need jvm, you can drop it
r

Rodrigo Munera

10/12/2023, 3:18 PM
If I move the dependency out of commonMain then my shared ktor client won't build. should I be using a different engine?
e

e5l

10/12/2023, 3:19 PM
you can omit and use
HttpClient() {
r

Rodrigo Munera

10/12/2023, 3:21 PM
Beautiful! Thank did it 🙂 thank you!
e

e5l

10/12/2023, 3:21 PM
@Viktoriya Nikolova could you please log an issue about the tutorial?
1
2 Views