J'ai un problème en essayant de distribuer mon application iOS avec Kotlin Multiplatform sur l'App Store d'Apple :
ERROR ITMS-90171 : "Invalid Bundle Structure - Le fichier binaire 'Smiledu_app.app/Frameworks/shared.framework/shared' n'est pas autorisé. Votre application ne peut pas contenir d'exécutables ou de bibliothèques autonomes, autres qu'un CFBundleExecutable valide des bundles pris en charge. Consultez le guide de programmation des bundles à l'adresse https://developer.apple.com/go/?id=bundle-structure pour des informations sur la structure des paquets d'applications iOS".
J'ai vérifié qu'il n'existe pas dans Phases de construction -> Copier les ressources de l'ensemble.
Voici mon fichier build.gradle.kts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
kotlin("plugin.serialization")
id("com.android.library")
id("kotlin-android-extensions")
id("com.squareup.sqldelight")
}
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
maven {
url = uri("https://dl.bintray.com/kotlin/kotlin-eap")
}
}
dependencies {
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.2.0")
}
configurations {
create("compileClasspath")
}
android {
compileSdkVersion(29)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(29)
versionCode = 1
versionName = "1.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
val libName = "shared"
kotlin {
android()
ios {
binaries.framework(libName)
}
val coroutinesVersion = "1.4.1-native-mt"
val serializationVersion = "1.0.0-RC"
val ktorVersion = "1.4.0"
val sqlDelightVersion = "1.4.3"
val reactive_version = "1.1.18"
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
// KTOR
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
// SQLDELIGHT
implementation("com.squareup.sqldelight:runtime:$sqlDelightVersion")
// Reactive
implementation("com.badoo.reaktive:reaktive:$reactive_version")
}
}
val androidMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("androidx.core:core-ktx:1.3.2")
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("com.squareup.sqldelight:android-driver:$sqlDelightVersion")
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
}
}
val iosMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.2")
// HTTP
implementation("io.ktor:ktor-client-ios:$ktorVersion")
implementation("com.squareup.sqldelight:native-driver:$sqlDelightVersion")
}
}
all {
languageSettings.apply {
progressiveMode = true
useExperimentalAnnotation("kotlin.RequiresOptIn")
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}
}
}
val packForXcode by tasks.creating(Sync::class) {
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks")
from({ framework.outputDirectory })
into(targetDir)
}
tasks.getByName("build").dependsOn(packForXcode)
sqldelight {
database("SmileduDataBase") {
packageName = "com.example.smiledu"
schemaOutputDirectory = file("src/commonMain/db/databases")
}
}