firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
IOS Firestore Transaction IncorrectDereferenceException
When I use firestore transaction I get an Uncaught Kotlin exception. Full output is like this:
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@325c7a8 from other thread
at 0...
I used it in a suspend function launched in a coroutine that uses Dispatchers.Main. Even if its lambda is empty I get the same error. The usage is simply like this:
fireStore.runTransaction {
...
}
My environment and library versions are:
IOS simulator - iPhone 13 - IOS 15
kotlin version = 1.5.30 coroutinesVersion = "1.5.2-native-mt" fireStoreVersion = "1.4.3"
IncorrectDereferenceException most of the time means that you've run the KMM code from non-main thread inside iOS.
IncorrectDereferenceExceptionmost of the time means that you've run the KMM code from non-main thread inside iOS.
Thanks for the reply, but I'm calling it from the main thread in IOS