Javal
09/22/2022, 12:40 PMUncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared
Shared kotlin code:
open val content: suspend () -> Content =
{ getContent() }
getContent() calls other suspend function to retrieve data from local cache.
iOS code:
func getContent() async -> Content {
await sharedGetApi.content.execute() //accessing shared `content` here.
}
extension KotlinSuspendFunction0 {
func execute<T>() async -> T {
do {
let result: T? = try await self.invoke() as? T
if let result = result {
return result
} else {
fatalError("\(T.self) can not be nil")
}
} catch {
fatalError(error.localizedDescription)
}
}
library versions:
coroutines = "1.6.3"
kotlin = "1.6.10"
Any help would be appreciated 🙏
TIAAlex Acosta
09/22/2022, 9:06 PMAlex Acosta
09/22/2022, 9:08 PM