https://kotlinlang.org logo
#ios
Title
# ios
c

curioustechizen

11/30/2023, 1:14 PM
Has anyone come across validation failures while trying to export an iOS app using KMP for release to the AppStore? My app runs successfully with development builds. While trying to export my app for the AppStore, the validation step fails complaining that the KMP framework has invalid characters. This is true: 1. My shared module in gradle land is
:foo:shared
2. which in the build.gradle.kts translates to
baseName = "foo-shared"
3. Ultimately this is exported as
foo_shared.framework
I cannot figure out how the baseName in point 2 got converted to the framework name in point 3.
a

Andrew Reed

12/08/2023, 9:55 AM
@curioustechizen - if you remove the hyphen and do fooShared instead, it should work
there is logic in the export that converts unsupported characters. I would avoid any special characters for ios libs, as it can be quite funny about it
c

curioustechizen

12/08/2023, 9:57 AM
I just hardcoded the name of the framework instead of relying on the logic in build.gradle.kts. That worked.
a

Andrew Reed

12/08/2023, 10:00 AM
by default i think it inheirts the folder name for example ‘shared’ but i would recommend you overwrite it to be ios friendly. You should be able to rely on the build gradle way though
c

curioustechizen

12/08/2023, 10:03 AM
Hmm I thought this snippet is created by the project creation wizard but maybe I was wrong. Looks like it comes from some template that I copied from somewhere:
Copy code
listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64(),
      ).forEach { target ->
        target.binaries.framework {
          baseName = path.substring(1).replace(':', '-')
        }
      }
This snippet in my build.gradle was responsible for turning
:foo:shared
into
baseName = "foo-shared"
a

Andrew Reed

12/08/2023, 10:04 AM
nooo
Copy code
listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64(),
      ).forEach { target ->
        target.binaries.framework {
          baseName = "foo"
        }
      }
this will then mean your ios framework will be import foo
i actually set the framework name in my gradle.properties and then import this into my build gradle file. This means i can then use that script in other projects
👍🏽 1
2 Views