hey guys, i'm marc from vienna, i'm working for vi...
# ios
m
hey guys, i'm marc from vienna, i'm working for vienna insurance group and we're currently trying out the use of KMM in our ios and android apps. maybe you can help me with this one? when xcode runs
./gradlew :shared:embedAndSignAppleFrameworkForXcode
it correctly compiles something into the
build
directory, but unfortunately it's not automatically put into the xcode proect (as i supposed it should). when enabling a lower log level i get that info:
Copy code
> Task :shared:assembleDebugAppleFrameworkForXcodeIosSimulatorArm64 UP-TO-DATE
^^^^^^^ so compilation worked, i'm even able to see the generated framework

> Task :shared:embedAndSignAppleFrameworkForXcode SKIPPED
Skipping task ':shared:embedAndSignAppleFrameworkForXcode' as task onlyIf 'Task is enabled' is false.
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
unfortunately there's no more info on it. the plugin correctly picks up the correct variante/target (
IosSimulatorArm64
), and also the target is is configured in the shared module's gradle file:
Copy code
val xcf = XCFramework()
    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "shared"
            isStatic = true
            xcf.add(this)
        }
    }
so i have no idea why this gradle task is skipped. i already saw this post here but the resolution seems to have some other reason. i'd be extremely grateful for any hints to solve this issue, thanks in advance 🙂
p
Xcode cannot automatically import a framework, you have to tell it how to. Certainly you can import a .framework manually(Google it) but is not convenient in this case because what you want is to be able to continuously develop. So far that you need to tell Xcode the local relative path where the .framework is located. For that, in build settings use options Framework Search Path and Other Linker Flags. You have to also add a script to run above Gradle task in the build phase before compilation
m
ok i noticed that that guide is missing the very important step to add a search path and set it to the shared module's output directory. maybe someone can update that. but thanks @Pablichjenkov for your response 🙌
p
It used to have that step but I believe it got removed. I guess the latest version of the Gradle task set that up for you automatically, if is not the case then a documentation ticket is needed. When you create the project in the KMP Web Portal it has those build settings already setup, you can always compare your project vs the web generated one.
m
ok i see. it'd be nice to find someone from jetbrains who can rectify that. it's unconvenient to need to find out your own even kmp is so highly advertized nowadays.
a
Adding search path manually is not required since 2.0. That is the reason why this step was removed from the documentation
m
you mean the kmp gradle plugin's version?
a
Yep