Hi All! Has anyone see this error: *`Coroutines mu...
# ktor
l
Hi All! Has anyone see this error:
Coroutines must be initialized from the main thread: call 'initMainThread' from the main thread first
?
I am launching raw socket API on iOS, ktor version
2.0.0-beta-1
e
@Vsevolod Tolstopyatov [JB] could you help?
t
Yes I've seen it before. It happens if you call coroutines code for the first time on a background thread.
You could call coroutines code from a main thread first, which should solve the issue
l
So, workaround - call any coroutine on main thread?
Cool, thanks, I'll try!
t
Yes and after that you can use it from background threads
Don't forget to call initRuntimeIfNeeded() in your background thread too
🙏 1
l
Thanks, @Thomas this helped!