Wondering if anyone has run into an issue like thi...
# multiplatform
Wondering if anyone has run into an issue like this when trying to build for a real iPhone target.
Copy code
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_SharedCodeEventUiModel", referenced from: objc-class-ref in EventUI.o
I assume I need to change my gradle setup but I'm unsure what exactly I need to change.
I was able to get the app to install by changing my
value to
but I'm now running into a crash when the app actually starts:
dyld: Library not loaded: @rpath/SharedCode.framework/SharedCode
In (xcode -> project settings -> Select target -> general -> frameworks, libraries and embedded content), you should see your shared KMP module. Make sure you select one of the embed options.
I didn't have it set to embed & sign (it was set to do not embed) unfortunately I still see the same crash. Is there a way to verify I'm bringing in the right framework?
right now its called
Are you packaging your KMP module as a framework or as Cocoapod? Each have a different setup and the name
implies you are using Cocoapods.
my gradle setup is based on a dated example and I'm not very familiar with how it works
Copy code
kotlin {
    targets {
        fromPreset(presets.android, 'android')

        final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                          ? presets.iosArm64 : presets.iosX64

        fromPreset(iOSTarget, 'ios') {
            binaries {


task packForXCode {
    def buildType = project.findProperty("kotlin.build.type") ?: "DEBUG"
    dependsOn "link${buildType.toLowerCase().capitalize()}FrameworkIos"

    doLast {
        def srcFile = kotlin.targets.ios.binaries.getFramework(buildType).outputFile
        def targetDir = getProperty("configuration.build.dir")
        copy {
            from srcFile.parent
            into targetDir
            include 'SharedCode.framework/**'
            include 'SharedCode .framework.dSYM'
thanks for the help so far, if you know of some docs I should be reading, I'd be happy to read those instead
Looks like it’s packaged as a framework called
.. have a look at this https://play.kotlinlang.org/hands-on/Targeting%20iOS%20and%20Android%20with%20Kotlin%20Multiplatform/06_SettingUpKotlinFramework . It contains all the steps needed.
👍 1
much appreciated!
worked perfectly, thank you!
😁 1
hey @yousefa2 sorry to bug you again, but do you have any experience with building an archive to upload to test flight? performing that build leads me to a compilation error claiming "no such module: "'SharedCode' " on an
import SharedCode
in one of my swift files