We are producing an iOS XCFramework for our SDK wh...
# multiplatform
s
We are producing an iOS XCFramework for our SDK which uses a KMP library provided as a SPM. The code works correctly on Android, but on iOS if we consume the XCFramework, then the first code that does any Kotlin allocations seems to fail with EXC_BAD_ACCESS. However this is only happening when consuming the XCFramework (which is built Debug), as running the code from the workspace works correctly. As you can see from the screenshot, it is failing in a kotlin.mm.AllocateArray call. Does anyone know how building the code into an XCFramework would cause the Kotlin allocations to fail? We are not embedding the KMP library, so it's being added as a dependency in the project using the SDK XCFramework, Is there some KMP library we need to add to the XCFramework?
I guess the other question is could it be thread related? Is KMP kotlin:mm:AllocateArray sensitve to the thread it is being called from, given that the first parameter seems to be ThreadData?
KT-70421 EXC_BAD_ACCESS on iOS when allocating an object in KMP code from XCFramework
We get a different error when trying to use our other KMP library which we can't hide with @_implementationOnly. This suggests it's something to do with linking the XCFramework in the App and adding the KMP library as a dependency in the app and XCFramework.
Screenshot 2024-08-02 at 18.02.15.png