https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
k

Kris Wong

04/25/2019, 10:01 PM
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

04/26/2019, 8:11 AM
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
k

Kris Wong

04/26/2019, 1:15 PM
Copy code
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

04/26/2019, 1:46 PM
Yes, you don’t have
iosArm32
preset configured, so this won’t work when building archive with armv7 enabled.
k

Kris Wong

04/26/2019, 1:50 PM
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:
Copy code
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")
                }
            }
        }
    }
4 Views