Hi Touchlab,
I tried to implement CrashKiOS for our project and was successful when the app was built for development on iOS. In the production environment, there was a crash immediately after the app started.
Here is the error I picked up from the Console.
Scene FBSceneManager/sceneID:<APPBUNDLE>-default update failed: <NSError: 0x283a1ddd0; domain: FBSceneErrorDomain; code: 1 ("operation-failed"); "Scene update failed."> {
NSUnderlyingError = <NSError: 0x283a1cba0; domain: FBWorkspaceScene; code: 1; "Client process exited.">;
}
COSMCtrl _foregroundAppActivity incoming bundle <APPBUNDLE> has nil supplied UUID, finds existing 6C105A4A-1D15-36F9-8818-5CA6E2CAA5B8
Here is my gradle.build.kts for xcode:
import xx.android.bld.dependencies.LibsCommon
import xx.android.bld.dependencies.ModulesCommon
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin(xx.android.bld.dependencies.PluginsCommon.Kotlin.multiplatform)
id(xx.android.bld.dependencies.PluginsCommon.CrashkiOS.id) version xx.android.bld.dependencies.VersionsCommon.crashkios // HERE
}
kotlin {
//select iOS target platform depending on the Xcode environment variables
val iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iOSTarget("ios") {
binaries {
framework {
baseName = "xxcommon"
export(project(ModulesCommon.domain))
export(project(ModulesCommon.repositories))
export(project(ModulesCommon.data))
export(project(ModulesCommon.appServices))
export(LibsCommon.Multiplatform.Kodein.erased)
//export(Libs.Multiplatform.Ktor.Client.Features.common)
}
}
sourceSets {
all {
languageSettings.optIn("kotlin.Experimental")
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
languageSettings.optIn("kotlinx.coroutines.FlowPreview")
languageSettings.optIn("kotlinx.serialization.InternalSerializationApi")
//languageSettings.optIn("kotlinx.serialization.UnstableDefault")
languageSettings.enableLanguageFeature("InlineClasses")
}
val commonMain by getting {
dependencies {
implementation(LibsCommon.Kotlin.stdLibCommon)
implementation(LibsCommon.Multiplatform.Kodein.erased)
//implementation(Libs.Multiplatform.Ktor.Client.Features.common)
api(project(ModulesCommon.infrastructure))
api(project(ModulesCommon.domain))
api(project(ModulesCommon.repositories))
api(project(ModulesCommon.data))
api(project(ModulesCommon.appServices))
}
}
val iosMain by getting {
dependencies {
implementation(project(ModulesCommon.infrastructure))
implementation(LibsCommon.Multiplatform.Logging.Napier.ios)
implementation(LibsCommon.Multiplatform.SQLDelight.Driver.ios)
implementation(LibsCommon.Crashkios.lib) // HERE
}
}
}
/* sourceSets["commonMain"].dependencies {
implementation(Libs.Kotlin.stdLibCommon)
api(project(Modules.domain))
api(project(Modules.repositories))
api(project(Modules.data))
} */
}
val packForXcode by tasks.creating(Sync::class) {
val targetDir = File(buildDir, "xcode-frameworks")
/// selecting the right configuration for the iOS
/// framework depending on the environment
/// variables set by Xcode build
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets
.getByName<KotlinNativeTarget>("ios")
.binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
from({ framework.outputDirectory })
into(targetDir)
/// generate a helpful ./gradlew wrapper with embedded Java path
doLast {
val gradlew = File(targetDir, "gradlew")
gradlew.writeText(
"#!/bin/bash\n"
+ "export 'JAVA_HOME=${System.getProperty("java.home")}'\n"
+ "cd '${rootProject.rootDir}'\n"
+ "./gradlew \$@\n"
)
gradlew.setExecutable(true)
}
}
tasks.getByName("build").dependsOn(packForXcode)
I just have no clue where to look to solve the issue. Maybe you will be able to see the problem here. Thank you for the feedback.
Hi Touchlab,
I tried to implement CrashKiOS for our project and was successful when the app was built for development on iOS. In the production environment, there was a crash immediately after the app started.
Here is the error I picked up from the Console.
Here is my gradle.build.kts for xcode:
I just have no clue where to look to solve the issue. Maybe you will be able to see the problem here. Thank you for the feedback.