swiftswiftuirealmkotlin-multiplatformrealm-mobile-platform

Identical methods in realm exception: unrecognized selector sent to instance


I have a kmm app. In swiftUI I call the login method from the Kotlin repo:

 repo.login(email: $userId.wrappedValue, password: $password.wrappedValue) { user, error in
      }

I have 2 methods that login identically on my Realm repository.

suspend fun login(email: String, password: String): User {
        return appService.login(Credentials.emailPassword(email, password))
    }
suspend fun dologin(email: String, password: String): User {
        return appService.login(Credentials.emailPassword(email, password))
    }

But just the first login works: repo.login

Whenever I try to use the second login: repo.dologin, it will show the exception:

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SharedRealmRepo dologinEmail:password:completionHandler:]: unrecognized selector sent to instance 0x281fe4960'
terminating with uncaught exception of type NSException

Why this happens? Do I need to recompile the shared module in some way?


Solution

  • It looks like removing the Output Files from XCode will solve the issue, but I do not know why.

    enter image description here

    Maybe someone has a explanation of why this happens. The output files will not let the realm repo re-build?