On iOS I'm getting ```kotlin.IllegalStateException...
# kotlin-native
m
On iOS I'm getting
Copy code
kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
in my native tests when I try to run something like
Copy code
GlobalScope.async { /* any code*/ }.await()
I'm running that code inside custom
runBlocking
implementation for iOS. What is the go to solution? Should I use custom
scope
for spawning corutines? How do you test async/await on iOS/native?
I'm getting that error also on final app. So it's not tests related issue.
m
You need to implement a dispatcher for ios
I used the Dispatcher from the KotlinConf app
m
thx, I'm also using this as my base, I'll take a look
m
And yes, define a new scope, GlobalScope uses the default dispatcher so it's not working
m
It worked, thx @mbonnin 🙂
👍 1