firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
Firebase Remote Configs: iOS activation method crash
Hi!
I have been using the Remote Configs module from the library I am opening this issue for. My first issue was the fact that you are not using the Native Multithreading version of the Kotlin Coroutines Core library, so I had to implement this workaround:
implementation("dev.gitlive:firebase-config:1.4.3") {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
}
After inserting that into my build.gradle.kts
, I can finally compile without issues.
I can also execute the available methods, like fetchAndActivate
, fetch
, etc.
Except activate()
. This function call is giving me an headache because it will always crash the iOS app, regardless if it is in the Main thread or not. Here is the stack trace:
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@824ca2a8 from other thread
at 0 Wrapper 0x000000010dd59720 kfun:kotlin.Throwable#<init>(kotlin.String?){} + 96
at 1 Wrapper 0x000000010dd52700 kfun:kotlin.Exception#<init>(kotlin.String?){} + 92
at 2 Wrapper 0x000000010dd52934 kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 92
at 3 Wrapper 0x000000010dd834c0 kfun:kotlin.native.IncorrectDereferenceException#<init>(kotlin.String){} + 92
at 4 Wrapper 0x000000010dd86660 ThrowIllegalObjectSharingException + 412
at 5 Wrapper 0x000000010f771af4 Kotlin_CString_toKStringFromUtf8Impl + 0
at 6 Wrapper 0x000000010f7737b4 _ZN12_GLOBAL__N_136terminateWithIllegalSharingExceptionEP9ObjHeader + 12
at 7 Wrapper 0x000000010f77d05c _ZNK16KRefSharedHolder3refIL11ErrorPolicy3EEEP9ObjHeaderv + 112
at 8 Wrapper 0x000000010f73d288 _ZL39Kotlin_Interop_unwrapKotlinObjectHolderP11objc_object + 48
at 9 Wrapper 0x000000010e14f150 _6465762e6769746c6976653a66697265626173652d636f6e666967_knbridge419 + 168
at 10 FirebaseRemoteConfig 0x00000001094e1a88 __42-[FIRRemoteConfig activateWithCompletion:]_block_invoke.207 + 44
at 11 libdispatch.dylib 0x0000000109c2c6d4 _dispatch_call_block_and_release + 32
at 12 libdispatch.dylib 0x0000000109c2e3b4 _dispatch_client_callout + 20
at 13 libdispatch.dylib 0x0000000109c30f2c _dispatch_queue_override_invoke + 1052
at 14 libdispatch.dylib 0x0000000109c42500 _dispatch_root_queue_drain + 408
at 15 libdispatch.dylib 0x0000000109c42f0c _dispatch_worker_thread2 + 196
at 16 libsystem_pthread.dylib 0x00000001f24660b8 _pthread_wqthread + 228
at 17 libsystem_pthread.dylib 0x00000001f2465e94 start_wqthread + 8
I am calling it on my AppDelegate.swift file like this:
remoteConfigs.activate(completionHandler: {(_,_) in })
It should be noted that calling fetchAndActivate()
in the same conditions works perfectly.
I assume stuff is being done in another thread, not the Main one, but I have no clue which one it is.
The exception error message does not show which object class it is referring to: <object>@824ca2a8
.
Due to the nature of Kotlin Multiplatform and Kotlin Native, what can be done for this to work? Is this an issue of mine, or is it an issue of this library?
Thank you.