hi all :wave: currently using Kotlin/Ktor `1.4.0` ...
# multiplatform
i
hi all 👋 currently using Kotlin/Ktor
1.4.0
to make a very simple API call on a multiplatform mobile project, however I get
Thread 1: EXC_BAD_ACCESS(code=1, ...)
error when I run the IOS code. Anybody run into this issue? It throws the error on this line in the
mainIos
source set:
actual val engine by lazy { Ios.create() }
would appreciate any insight 🙂
s
I think
lazy
will freeze implicitly, resulting in that crash because ktor doesn't support it yet
Have you tried using
atomicLazy
?
i
Haven't tried
atomicLazy
but I had the same code with the
lazy{...}
on a project with Kotlin 1.3.72 and everything ran fine. Only getting this issue recently though 🤔
l
@Ivann Ruiz Which kotlinx.coroutines version do you see when you do
./gradlew :yourModule:dependencies
?
i
I have coroutines version set to
1.3.9
. What fixed my freezing problem was to downgrade Ktor from
1.4.0
to
1.3.2-1.4.0-rc
m
Hmm all I can say is be careful using ktor on iOS. Last time I ran into so many deadlock issues to even count, that I gave up after 2 weeks of debugging and trying to work around different issues. For example:
Copy code
<https://github.com/ktorio/ktor/issues/821>
<https://github.com/ktorio/ktor/issues/679>
<https://github.com/ktorio/ktor/issues/770>
nowadays I abstract the client to native ios/android implementations that make the network call using their own platform libraries