I believe I just found a mistake in the KMM gettin...
# multiplatform
s
I believe I just found a mistake in the KMM getting started guide: https://ktor.io/docs/getting-started-ktor-client-multiplatform-mobile.html#ktor-dependencies The following code block, for adding the iOS-native Ktor library, results in build errors because the
ios…Main
targets don’t exist:
Copy code
val iosMain by creating {
    dependsOn(commonMain)
    iosX64Main.dependsOn(this)
    iosArm64Main.dependsOn(this)
    iosSimulatorArm64Main.dependsOn(this)
    dependencies {
        implementation("io.ktor:ktor-client-darwin:$ktorVersion")
    }
}
I’m able to get it working by changing it to:
Copy code
val iosMain by getting {
    dependencies {
        implementation("io.ktor:ktor-client-darwin:$ktorVersion")
    }
}
a
🤔 in my case, those ios targets works fine. Maybe I am wrong, but project launch well. (https://github.com/arstagaev/KMM-Sample-Shared-Ktor-Delight/blob/1bd1eefac026458ad48baa4c7a1988234a9bb9d8/shared/build.gradle.kts#L86 ) Need error code
s
Ah, your gradle script defines those three dependent sourceSets above the
iosMain
one: https://github.com/arstagaev/KMM-Sample-Shared-Ktor-Delight/blob/1bd1eefac026458ad48baa4c7a1988234a9bb9d8/shared/build.gradle.kts#L83 The guide doesn’t seem to say to do that.
a
yeah, but it works:)