Skip to content

kotlin.ClassCastException: class kotlin.native.internal.NSDictionaryAsKMap cannot be cast to class kotlin.String #27

@mrgdev

Description

@mrgdev

I use mokoSocketIo in Kotlin multiplatform project for both platform, ios and Android. In Android all works as expected. In iOS
I receive the following error when I try to emit text message to the server:
Uncaught Kotlin exception: kotlin.ClassCastException: class kotlin.native.internal.NSDictionaryAsKMap cannot be cast to class kotlin.String
at 0 shared 0x10701027b kfun:kotlin.Throwable#(kotlin.String?){} + 107 (/opt/buildAgent/work/acafc8c59a79cc1/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:25:37)
at 1 shared 0x107009df7 kfun:kotlin.Exception#(kotlin.String?){} + 103 (/opt/buildAgent/work/acafc8c59a79cc1/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
at 2 shared 0x10700a037 kfun:kotlin.RuntimeException#(kotlin.String?){} + 103 (/opt/buildAgent/work/acafc8c59a79cc1/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
at 3 shared 0x10700aab7 kfun:kotlin.ClassCastException#(kotlin.String?){} + 103 (/opt/buildAgent/work/acafc8c59a79cc1/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:106:44)
at 4 shared 0x10704348e ThrowClassCastException + 782 (/opt/buildAgent/work/acafc8c59a79cc1/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:31:11)
at 5 shared 0x107484879 kfun:dev.icerock.moko.socket.SocketEvent.Error#mapper(kotlin.collections.List<>){}kotlin.Throwable + 425 (/Users/runner/work/moko-socket-io/moko-socket-io/socket-io/src/iosMain/kotlin/dev/icerock/moko/socket/SocketEvent.kt:37:49)
at 6 shared 0x1074831fc kfun:dev.icerock.moko.socket.Socket.object-1.on$lambda$1#internal + 604 (/Users/runner/work/moko-socket-io/moko-socket-io/socket-io/src/iosMain/kotlin/dev/icerock/moko/socket/Socket.kt:39:44)
at 7 shared 0x10748354b kfun:dev.icerock.moko.socket.Socket.object-1.$on$lambda$1$FUNCTION_REFERENCE$1.invoke#internal + 107 (/Users/runner/work/moko-socket-io/moko-socket-io/socket-io/src/iosMain/kotlin/dev/icerock/moko/socket/Socket.kt:38:25)
at 8 shared 0x1074836ed kfun:dev.icerock.moko.socket.Socket.object-1.$on$lambda$1$FUNCTION_REFERENCE$1.$invoke(kotlin.collections.List<
>?){}#internal + 93 (/Users/runner/work/moko-socket-io/moko-socket-io/socket-io/src/iosMain/kotlin/dev/icerock/moko/socket/Socket.kt:38:25)
at 9 shared 0x1074839f3 6465762e696365726f636b2e6d6f6b6f3a736f636b65742d696f2f55736572732f72756e6e65722f776f726b2f6d6f6b6f2d736f636b65742d696f2f6d6f6b6f2d736f636b65742d696f2f736f636b65742d696f2f7372632f696f734d61696e2f6b6f746c696e2f6465762f696365726f636b2f6d6f6b6f2f736f636b65742f536f636b65742e6b74_knbridge10 + 275 (/Users/runner/work/moko-socket-io/moko-socket-io/socket-io/src/iosMain/kotlin/dev/icerock/moko/socket/Socket.kt:38:25)
at 10 mokoSocketIo 0x104ba355c $sSo7NSArrayCIeyBy_SayypGIegg_TR + 44
at 11 mokoSocketIo 0x104ba33e1 $s12mokoSocketIo0bC0C2on11socketEvent6actionyAA0bF0O_ySayypGctFyAI_0B2IO0B10AckEmitterCtcfU1
+ 81 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/mokoSocketIo/socket-io/src/iosMain/swift/SocketIo.swift:122:7)
at 12 SocketIO 0x104eb4b08 $s8SocketIO0A12EventHandlerV15executeCallback4with0G3Ack0gA0ySayypG_SiAA0A8IOClientCtF + 168 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketEventHandler.swift:48:9)
at 13 SocketIO 0x104ebf1c2 $s8SocketIO0A8IOClientC11handleEvent_4data17isInternalMessage7withAckySS_SayypGSbSitF + 1314 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:373:21)
at 14 SocketIO 0x104ebf7b5 $s8SocketIO0A8IOClientC12handlePacketyyAA0aE0VF + 293 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Client/SocketIOClient.swift:386:13)
at 15 SocketIO 0x104ece8db $s8SocketIO0A7ManagerC19_parseEngineMessage33_FEE990CFC310EDF111B3A4D77C509822LLyySSF + 491 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManager.swift:416:27)
at 16 SocketIO 0x104ece5bf $s8SocketIO0A7ManagerC18parseEngineMessageyySSFyycfU_ + 63 (/Users/hadzinets/Workspace/AIDA/flutter_new/mobile/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Manager/SocketManager.swift:404:18)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions