Hi folks, I’m doing a PoC, trying to refactor a An...
# multiplatform
s
Hi folks, I’m doing a PoC, trying to refactor a Android module to KMM to integrate in the iOS app. We are using Kotlin 1.7,10, I did enable the Expertimental Memory Management but any kotlin object allocation seems to crash the iOS app. iOS stacktrace and more information in the 🧵
#0 kotlin:mm:AllocateArray(kotlin:mm:ThreadData*, TypeInfo const*, unsigned int, ObjHeader**) () #2 Kotlin_ObjCExport_refFromObjC () #3 objc2kotlin.3101 at /<compiler-generated>:1 #6 Swift file and line that tries to instanciate a data class
Our gradle properties
Copy code
kotlin.native.binary.memoryModel=experimental
kotlin.native.binary.freezing=disabled
kotlin.native.cacheKind=none
cc @svyatoslav.scherbina
The project is being exported as XCFramework using the new
kotlinArtifacts
DSL.
s
Hi. Well, that is clearly not enough to give any meaningful advice. Could you please provide assembly listings of frames 0-3, including the exact position in the listings?
s
I was exporting the XCFramework to iOS with
isStatic = true
, seems that was the issue. This is expected @svyatoslav.scherbina?
s
Do you use this XCFramework in multiple modules of your project? Is one of them a dynamic library/framework?
s
Yes! But the usage for
isStatic = true
was not soemthing that I really need, is something that I configured that way without knowing. The integration did work, pretty happy with the result K
s
Great, thank you for letting me know!