https://kotlinlang.org logo
b

Bilal Maarbani

06/23/2023, 12:36 PM
Hello everyone i’m Bilal, i’m a senior IOS developer, i started with kotlin multiplatform new project, i tried to integrate a Ktor to gradle but i have an issue and i need your help! thank you
j

Johann Pardanaud

06/23/2023, 12:45 PM
State your problem, otherwise we cannot help 😉
b

Bilal Maarbani

06/23/2023, 12:51 PM
when i add ktor to build.gradle.kts ( implementation(“io.ktorktor client core2.3.1")) and sync the project all things good from android side, but when i try to build and run the IOS project from Xcode, the error appear ” return Command PhaseScriptExecution error Kotlin Multiplatform “, when i remove the ktor the ios run correctly
m

MamboBryan

06/23/2023, 12:59 PM
You need to have specific ktor clients for each platform android - okhttp iOs - dawrin https://ktor.io/docs/http-client-engines.html
b

Bilal Maarbani

06/23/2023, 1:06 PM
i forget to mention that i use cocoapods to IOS
p

Pablichjenkov

06/23/2023, 2:00 PM
The PhaseScriptExecution can fail for multiple reasons try to see what fails the build more specific. You can check this project setup, it has ktor and SQDelight. Check if it run on you side: https://github.com/pablichjenkov/kmp-amadeus-api
b

Bilal Maarbani

06/23/2023, 2:38 PM
i will check it thank you
hello again!
the issue not solved please can you see the project? https://github.com/numericslick/uqariya.git
the error when i add ktor to common by getting in build.gradle
implementation(“io.ktorktor client core2.3.1”)
when i add this to common by getting, the IOS display an error and the app not run
m

MamboBryan

06/24/2023, 11:10 AM
I've looked at the repo you shared, is there a client such as
Copy code
client-ios
I stand to be corrected but the only client for native is darwin
Copy code
implementation("io.ktor:ktor-client-ios:$ktorVersion")
Copy code
implementation("io.ktor:ktor-client-darwin:$ktor_version")```
b

Bilal Maarbani

06/24/2023, 2:10 PM
i don’t know where is the problem
but the problem not solved
when i add implementation(“io.ktorktor client core$ktorVersion”) to common by gretting the android run but ios not run and give that error
anyone can help with my issue?
m

MamboBryan

06/27/2023, 8:31 AM
You need to add this in your ios platform
Copy code
ios by getting {
  dependencies {
    implementation("io.ktor:ktor-client-darwin:$ktor_version")
  }
}
If you have not already done it
4 Views