rickclephas / NSExceptionKt

A Kotlin Multiplatform Library to improve crash reports on Apple platforms
MIT License
168 stars 12 forks source link

No such module 'NSExceptionKtCrashlytics' #31

Closed deividasstr closed 1 month ago

deividasstr commented 1 month ago

I am seeing a similar build issue to this other issue. It is closed but the owner did not specify the solution.

Build error:

Screenshot 2024-07-26 at 11 17 32 Screenshot 2024-07-26 at 11 17 10

Warning above:

Screenshot 2024-07-26 at 12 01 11

App delegate

Screenshot 2024-07-26 at 11 50 53

Interesting that when I get linked to the NSExceptionKt class when clicking on it:

Screenshot 2024-07-26 at 11 19 52

Crashlytics addition via SPM

Screenshot 2024-07-26 at 11 18 35 Screenshot 2024-07-26 at 11 18 21

build.gradle setup uses a bit more modern approach, but should output the same:

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "Shared"
            isStatic = true
            export(libs.ios.nsexception.tracker)
        }
    }
...
    sourceSets {
       iosMain {
            dependencies {
                implementation(libs.ktor.client.darwin)
                api(libs.ios.nsexception.tracker)
            }
        }

Tried using string dependency (com.rickclephas.kmp:nsexception-kt-core:1.0.0-BETA-4) instead of version catalogs, issue persists.

Bumping back to BETA1 did not work too.

Just FYI, when looking at a sample, I see that the dependency does not contain version.

rickclephas commented 1 month ago

It looks like the Swift part of the library wasn't added via SPM. NSExceptionKtCrashlytics is actually the Swift part for Crashlytics. The NSExceptionKt class is indeed coming from Kotlin.

Adding https://github.com/rickclephas/NSExceptionKt as a SPM dependency and then adding NSExceptionKtCrashlytics to your target should do the trick.

Just FYI, when looking at a sample, I see that the dependency does not contain version.

Correct. The sample uses the included build to build against the source instead of a released version.

deividasstr commented 1 month ago

Thanks alot for the swift reply!

Yes, I missed this part of the docs: Now in your Xcode project [add](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app) the NSExceptionKtCrashlytics dependency and update your Firebase configuration logic with a call to NSExceptionKt.addReporter:

For a bit, I was confused what url exactly should I provide to the SPM, and it is the url of this github repo.