Closed puelocesar closed 3 years ago
Are you building your shared module as a dynamic framework? Something along the lines of
targets.withType<KotlinNativeTarget> {
binaries.withType<Framework> {
isStatic = false
...
}
}
To follow up on that, the issue is that including Firebase in a dynamic library framework is problematic. This is less of a Kotlin thing than an Xcode framework thing.
https://github.com/firebase/firebase-ios-sdk/blob/master/docs/firebase_in_libraries.md
For static frameworks, we're providing a stub binary you can link against so the linker is happy for testing builds. For dynamic frameworks, the only real solution would be to pull in firebase itself, which we'd rather avoid.
I'm still thinking through this, but for now, using Kermit's Crashlytics support requires using static frameworks. To use dynamic, you'd need to implement a Crashlytics logger from Objc/Swift and pass it in. Not ideal, of course, but it's not too difficult. Hopefully we'll have something more user friendly soon.
Ok, it makes sense, but I'm still getting the same errors after changing my Firebase installation to be static. And there's something I still don't get, in Xcode, KMM step runs before linking with Pods, so how can Kotlin know where are the Pod libraries?
Here's how the iOS app is configured in my Gradle:
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = when {
System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64
System.getenv("NATIVE_ARCH")?.startsWith("arm") == true -> ::iosSimulatorArm64
else -> ::iosX64
}
iosTarget("ios") {
binaries {
framework {
baseName = "shared"
}
}
}
The Kotlin framework needs to be static.
iosTarget("ios") {
binaries {
framework {
baseName = "shared"
isStatic = true
}
}
}
That did the trick, thanks for all the help
I'm trying to follow the instructions on https://github.com/touchlab/Kermit/pull/177 for integrating Kermit Crashlytics, but my builds now always fail with this error message:
Is there anything else I'm missing? I'm using Kermit version "1.0.0-rc4"