Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrgdev opened this issue Jun 21, 2023 · 5 comments

Comments

@mrgdev
Copy link

mrgdev commented Jun 21, 2023

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)

@Alex009
Copy link
Member

Alex009 commented Jun 22, 2023

hi. can you show your Podfile.lock content?
i see that error here:

but why socket error event have Dictionary instead of String (that works in past) need to research.

@mrgdev
Copy link
Author

mrgdev commented Jun 22, 2023

Hi, here is Podfile.lock

PODS:

  • mokoSocketIo (0.4.0):
    • Socket.IO-Client-Swift (~> 15.2.0)
  • Socket.IO-Client-Swift (15.2.0):
    • Starscream (~> 3.1)
  • Starscream (3.1.1)

DEPENDENCIES:

  • mokoSocketIo (from https://github.com/icerockdev/moko-socket-io.git, tag release/0.4.0)

SPEC REPOS:
trunk:
- Socket.IO-Client-Swift
- Starscream

EXTERNAL SOURCES:
mokoSocketIo:
:git: https://github.com/icerockdev/moko-socket-io.git
:tag: release/0.4.0

CHECKOUT OPTIONS:
mokoSocketIo:
:git: https://github.com/icerockdev/moko-socket-io.git
:tag: release/0.4.0

SPEC CHECKSUMS:
mokoSocketIo: 072c66dcab984f441fefe68db0b50f7a5215f15e
Socket.IO-Client-Swift: 1e3e3a1f09f3312a167f0d781eb2f383d477357c
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0

PODFILE CHECKSUM: 2b253774b0967eda50a0f1de249358e77b3f7d0a

COCOAPODS: 1.12.1

@mrgdev
Copy link
Author

mrgdev commented Jul 12, 2023

Hi @Alex009 , I need to understand if I should search for a new solution or wait until this issue would be fixed. Do you have any updates here?

@Alex009
Copy link
Member

Alex009 commented Jul 12, 2023

@mrgdev you can send PR with fixes and i publish update in few days.

@mrgdev
Copy link
Author

mrgdev commented Jul 12, 2023

@Alex009 , thank you for the answer. I will try to find another solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants