I have a kmm app. In swiftUI I call the login meth...
# multiplatform
d
I have a kmm app. In swiftUI I call the login method from the Kotlin repo:
Copy code
repo.login(email: $userId.wrappedValue, password: $password.wrappedValue) { user, error in
      }
I have 2 methods that login identically on my Realm repository.
Copy code
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:
Copy code
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?
1
e
it looks like that you invoke
repo.dologin
from some closure and
repo
instance no longer exists. probably it can be fixed if you will use
self.repo.dologin
. I am pretty sure there is no problem with method name or with shared module compilation, in that case you would have compile-time error, not runtime
d
still not, neither with the
self
..
I think that he does not recognize the other methods from the shared.. how is that possible 😕?
'NSInvalidArgumentException', reason: '-[SharedRealmRepo dologinEmail:password:completionHandler:]: unrecognized selector sent to instance 0x282e0c450'
it looks like that the swift can see the method but whenever i change for example the login:
self.repo.login(email: $userId.wrappedValue){user, error in
by removing the password parameter, it will display the same error:
[SharedRealmRepo loginEmail:completionHandler:]: unrecognized selector sent to instance 0x2806c98c0'
I think that the shared does not refreshes the method, how is possible that this could happen?
How can I ensure that the changes made in android studio will be re-build on the xcode?
It looks like removing the Output Files from XCode will solve the issue, but I do not know why.