I'm running an iOS project with KMP dependency wit...
# multiplatform
n
I'm running an iOS project with KMP dependency with cocoapods plugin. I ran
podspec
, then specified
pod 'my-pod', :path => '../my-pod'
in project's Podfile and ran
pod install
. I can import classes in Xcode and autocomplete works just fine, but when I try to build it, I get
Copy code
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AnalyticsInitParameters", referenced from:
      objc-class-ref in ContentView.o
  "_OBJC_CLASS_$_AnalyticsAnalytics", referenced from:
      objc-class-ref in ContentView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I doing wrong? Did I skip anything?
k
do you have iosX64 target defined in your project?
n
I have
ios {}
target
I also tried with
Copy code
val buildForDevice = project.findProperty("kotlin.native.cocoapods.target") == "ios_arm"
    if (buildForDevice) {
        iosArm64("iOS64")
        iosArm32("iOS32")

        val iOSMain by sourceSets.creating
        sourceSets["iOS64Main"].dependsOn(iOSMain)
        sourceSets["iOS32Main"].dependsOn(iOSMain)
    } else {
        iosX64("iOS")
    }
k
and these symbols are defined in your module, or a dependency?
n
In a module
I think
Copy code
kotlin {
    jvm {}
    ios {}
    ...
}
In the module that contains KMP code
Which is then specified in Podfile
Did I understand your question correctly?
k
i am asking if the symbols are a part of your project's codebase, or from a dependency
n
They're from project's codebase
k
interesting
n
I'll leave it here for the future generations Replacing
use_frameworks!
with
use_modular_headers!
did the trick
Alas, it built successfully one time, and the next time without changing a byte it throws same exception again
k
well that's quite strange
n
I get it running again
My mistake was having both
use_frameworks!
and
use_modular_headers!
If I remove
use_fragments!
, it works again
But what do I do if I need
use_fragments!
?