Thread
#multiplatform
    Kris Wong

    Kris Wong

    3 years ago
    also, when I archive my app from Xcode, I am getting undefined symbols from my mpp project: Undefined symbols for architecture armv7: "OBJC_CLASS$_ConferenceDialerConferenceDialerParser", referenced from: objc-class-ref in ConferenceParserFactory.o objc-class-ref in ConferenceParserV2Adapter.o ld: symbol(s) not found for architecture armv7
    s

    svyatoslav.scherbina

    3 years ago
    You probably don’t have
    iosArm32
    target in your Gradle build. Please take a look at this sample for more details: https://github.com/JetBrains/kotlin-native/tree/master/samples/cocoapods
    Kris Wong

    Kris Wong

    3 years ago
    def buildForDevice = project.findProperty('kotlin.native.cocoapods.target') == 'ios_arm'
            def iosPreset = (buildForDevice) ? presets.iosArm64 : presets.iosX64
            fromPreset(iosPreset, 'ios') {
                compilations.main {
                    cinterops {
                        phonenumbers
                    }
                }
                binaries {
                    framework("$ios_framework_name")
                }
            }
    i am still investigating to see what error I get for the different build variants
    s

    svyatoslav.scherbina

    3 years ago
    Yes, you don’t have
    iosArm32
    preset configured, so this won’t work when building archive with armv7 enabled.
    Kris Wong

    Kris Wong

    3 years ago
    i suppose the project does have a deployment target of 10. thank you, let me try that.
    how do I specify the cinterop and framework name as I have done with the 2 different presets? do I do it for both?
    i am also having trouble figuring out how to create the
    iosMain
    source set with groovy DSL
    seems to be working with the following:
    targets {
            fromPreset(presets.jvm, 'jvm')
            
            def buildForDevice = project.findProperty('kotlin.native.cocoapods.target') == 'ios_arm'
            if (buildForDevice) {
                fromPreset(presets.iosArm64, 'ios64') {
                    compilations.main {
                        cinterops {
                            phonenumbers
                        }
                    }
                    binaries {
                        framework("$ios_framework_name")
                    }
                }
                fromPreset(presets.iosArm32, 'ios32') {
                    compilations.main {
                        cinterops {
                            phonenumbers
                        }
                    }
                    binaries {
                        framework("$ios_framework_name")
                    }
                }
    
                sourceSets["ios64Main"].dependsOn(sourceSets["iosMain"])
                sourceSets["ios32Main"].dependsOn(sourceSets["iosMain"])
            } else {
                fromPreset(presets.iosX64, 'ios') {
                    compilations.main {
                        cinterops {
                            phonenumbers
                        }
                    }
                    binaries {
                        framework("$ios_framework_name")
                    }
                }
            }
        }