I have caught `kotlin.TypeCastException` while usi...
# multiplatform
p
I have caught
kotlin.TypeCastException
while using coroutine’s
async/await
in
common
when running on iOS. But it works well on Android. Any advice to go about this?
s
p
Thanks, I saw the closed issue about using
delay
caused
TypeCastException
but it is actually
IllegalStateException
because the dispatcher doesn’t implement the Delay interface. So we will have to implement the Deferred<Unit> (Generic is not available K/N) in to a custom dispatcher class? Are there any examples to go about it?
s
Thanks, I saw the closed issue about using
delay
caused
TypeCastException
but it is actually
IllegalStateException
because the dispatcher doesn’t implement the Delay interface.
Could you clarify, do you encounter
TypeCastException
or
IllegalStateException
?
So we will have to implement the Deferred<Unit> (Generic is not available K/N) in to a custom dispatcher class?
How is
Deferred
related?
p
>> Could you clarify, do you encounter
TypeCastException
or
IllegalStateException
?
I encountered
kotlin.TypeCastException
when using
async/await
in
commonMain
>> How is
Deferred
related?
https://github.com/Kotlin/kotlinx.coroutines/issues/470, The temporary solution to solving
TypeCastException
for using
delay
is to implement
Delay
to the class subclassing
CoroutineDispatcher()
. So if I am not mistaken, the problem to
TypeCastException
to using
async/await
is the implementation of the
Deferred
interface in class that subclass
CoroutineDispatcher()
.
s
Do you mean
Deferred
or
Delay
?
Are there any examples to go about it?
I believe there is one in the comments to the issue.