Hi folks! Does anyone know how to override the pla...
# multiplatform
a
Hi folks! Does anyone know how to override the platform created from the Shared module? In these last weeks, I went through the Get Started with Kotlin Multiplatform Tutorial, but today, I wanted to consume the flow from Swift configuring KMP-NativeCoroutines; before starting, my XCode asked me to update my iOS SDK from 17.4 to 17.5; after the update was installed, I opened the
iosApp
project and suddenly I started to receive this error:
Copy code
/GreetingKMP/iosApp/iosApp/ContentView.swift:2:8: error: cannot load module 'Shared' built with SDK 'iphonesimulator17.4' when using SDK 'iphonesimulator17.5
 /GreetingKMP/shared/build/xcode-frameworks/Debug/iphonesimulator17.5/Shared.framework/Modules/Shared.swiftmodule/arm64-apple-ios-simulator.swiftmodule import Shared
To solve the issue, I considered recreating the platform. I invalidated caches and rebuilt the shared module and the XCode project several times without success; in the end, changing the baseName made it work!
Copy code
iosTarget.binaries.framework {
            baseName = "DevShared" // <<-- I changed this name from "Shared"
            isStatic = true
        }
r
I started getting this issue recently. Any way to solve without changing the base name?
p
I remember issues of this nature when renaming Xcode projects and such. Did you try clearing the DerivedData in Xcode? It works sometimes.
r
Will try it out thanks
y
The error basically says the cached framework that was built previously was using an older iOS version. gradle clean or deleting the
build
folder for the shared module should be enough to create a new framework with correct iOS version.
👍 2
r
ah good stuff, thanks