https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotlin-native
  • s

    Stefan Oltmann

    02/24/2023, 4:03 PM
    I have defined:
    kotlin {
        mingwX64("native") {
            binaries {
                executable()
            }
        }
    }
    That results in
    ModuleVersionNotFoundException: Could not find :kotlin-native-prebuilt-windows-aarch64:1.6.10.
    I am currently using the ARM version of Windows 11, which has the ability to run x64 code. I would like to know how I can modify my Gradle configuration to prioritize the use of the x64 version instead of searching for the aarch64 version.
    l
    e
    +2
    • 5
    • 10
  • r

    Roberto Leinardi

    02/27/2023, 10:02 AM
    Hi everyone, I'm working on a GIR generator to create kotlin native bindings for GTK and other GObject based libraries. I reached a stage where I can almost compile the bindings for GLib but I'm stuck with the handling of `vararg`s. For example
    g_string_append_printf
    , which is mapped with this:
    @kotlinx.cinterop.internal.CCall public external fun g_string_append_printf(string: kotlinx.cinterop.CValuesRef<native.glib.GString /* = native.glib._GString */>?, @kotlinx.cinterop.internal.CCall.CString format: kotlin.String?, vararg variadicArguments: kotlin.Any?): kotlin.Unit { /* compiled code */ }
    It seems to expect a
    vararg variadicArguments: kotlin.Any?
    , but if I send that to it like this:
    public fun appendPrintf(format: String, vararg variadicArguments: Any): Unit {
            g_string_append_printf(cPointer.reinterpret(), format, variadicArguments)
        }
    I get this error when I build the module:
    type kotlin.Array<out kotlin.Any>  is not supported here: doesn't correspond to any C type
    The GIR parameter only gives a name (
    ...
    ) and has a tag `varargs`:
    <parameter name="..." transfer-ownership="none">
                <doc xml:space="preserve"
                     filename="glib-2.0.c"
                     line="32361">the parameters to insert into the format string</doc>
                <varargs/>
              </parameter>
    But there are no other information about the type. I am an Android developer and not very familiar with C Interop. Does anyone have a suggestion of what this
    vararg variadicArguments: kotlin.Any?
    should be converted to?
    a
    b
    +2
    • 5
    • 20
  • d

    David Herman

    02/27/2023, 8:39 PM
    I'm trying to write some code using
    termios
    in K/N.
    termios
    is a struct which has a bitflag field called
    c_lflag
    ; its type is
    platform.posix.tcflag_t
    which appears to be an int on mac and a uint on linux. I'm trying to do some bit logic like this:
    newTermios.c_lflag.and((_ECHO_.or(_ICANON_.or(_IEXTEN_))).inv())
    (equivalent to
    c_lflag & ~(ECHO | ICNON | IEXTEN)
    in C). In order to support both targets, I thought
    ECHO.or(...) as tcflag_t
    would work, but I'm getting a warning that the cast will never succeed. What's the right solution here?
    e
    l
    • 3
    • 10
  • v

    vbsteven

    02/28/2023, 8:13 AM
    What would be a good approach for K/N libraries that "wrap" native libraries with possibly different versions where new minor upstream versions have additional functions/types and possibly deprecations? (for example GTK) In the
    gtk-rs
    case in Rust land they handle it with Cargo features where an application developer can depend on the
    gtk4
    crate which exposes the
    4.0
    API by default and
    features = [4_2]
    can be used in Cargo.toml to unlock newer API functions. - One possible solution is to have different library versions for each upstream dependency version but that can get unwieldy quickly. - Maybe something is possible with Kotlin annotations that conditionally enable additional methods based on properties in Gradle (equivalent to Cargo features). - Another approach could be to not distribute generated bindings and instead wrap the bindings-generator (GIR-based) into a Gradle plugin that is configured with the desired library version in the gradle DSL and generates the bindings at build-time. Has anyone already done something like this? Any thoughts?
    b
    a
    • 3
    • 13
  • r

    Roberto Leinardi

    02/28/2023, 3:52 PM
    I get this strange type mismatch when I call `gtk_cell_area_foreach_alloc`:
    Type mismatch: inferred type is GtkCellAllocCallback /* = CPointer<CFunction<(CPointer<GtkCellRenderer /* = _GtkCellRenderer */>?, CPointer<GdkRectangle /* = native.gdk._cairo_rectangle_int */>?, CPointer<GdkRectangle /* = native.gdk._cairo_rectangle_int */>?, CPointer<out CPointed>?) -> gboolean /* = Int */>> */ but GtkCellAllocCallback? /* = CPointer<CFunction<(CPointer<GtkCellRenderer /* = _GtkCellRenderer */>?, CPointer<GdkRectangle /* = native.gtk._cairo_rectangle_int */>?, CPointer<GdkRectangle /* = native.gtk._cairo_rectangle_int */>?, gpointer? /* = CPointer<out CPointed>? */) -> gboolean /* = Int */>>? */ was expected
    I really don't get what the issue is: it is expecting a
    GtkCellAllocCallback?
    and I'm giving it a
    GtkCellAllocCallback?
    . Does anyone have a clue of what the issue could be?
    • 1
    • 2
  • d

    Duane Malcolm

    03/01/2023, 7:19 PM
    Is there a way to have different input types for setters? For example,
    var bar: String = "5"
    var foo: String
        get() { return bar }
        set(value: String) { bar = value }
        set(value: Int) { bar = value.toString() }
        set(value: Float) { bar = round(value).toInt().toString() }
    a
    e
    • 3
    • 5
  • o

    Omico

    03/02/2023, 12:46 AM
    The
    GetFileVersionInfoSizeW
    function is in the
    platform.windows.*
    package, but why am I getting
    lld-link: error: undefined symbol: GetFileVersionInfoSizeW
    ?
    e
    l
    • 3
    • 3
  • f

    felix

    03/02/2023, 8:29 AM
    Is there a possibility to disable cinterop for selected pods?
    build.gradle.kts
    plugins {
            kotlin("native.cocoapods")
    ...
    kotlin {
      cocoapods {
            pod("pod_a") {
                version = "1.0"
                source = path(project.file("../pod_a"))
            }
            pod("pod_b") {
                version = "1.0"
                source = path(project.file("../pod_b"))
            }
    ...
    e.g. How can I disable cinterop for pod_a?
    l
    • 2
    • 2
  • m

    Mitchell Syer

    03/04/2023, 4:24 AM
    I want to try making a program using https://learn.microsoft.com/en-us/windows/win32/api/_coreaudio/. I see that the headers are in konan, but there doesn't seem to be any imports for the classes and interfaces? Am I missing something or is there a compiler option I need to use
    • 1
    • 1
  • l

    Lucy

    03/05/2023, 3:44 AM
    I'm looking for a fairly low level language (need access to platform APIs, building shared libraries, pointers), and I'm wondering if Kotlin/Native might suffice for that. I've ruled out C/C++ and Rust already because I'd prefer something else. Decent community support/libraries would also be nice. Thoughts?
    v
    l
    • 3
    • 27
  • i

    Ignat Beresnev

    03/05/2023, 8:30 AM
    Hi! I can't figure out if it's a bug or a feature, maybe someone with experience can help 🙂 I'm building a shared (
    .dll
    ) library on Windows. If I build a vanilla Kotlin/Native project, the DLL exported symbols seem to be all public functions (screenshot 1). My own top-level
    @CName
    function is exported, I can see it. However, if I add an implementation dependency on kotlin-libui (cc @msink), DLL exported symbols are UI only (screenshot 2). My top-level
    @CName
    function is NOT exported, neither are any other K/N functions. Looks like the exports are taken from libui only and the rest is ignored. The
    .def
    and
    .h
    files are the same, so they contain my top-level function, but of course it fails in runtime whenever I try to load the DLL.
    kotlin {
        val nativeMain by sourceSets.getting {
            dependencies {
                implementation("com.github.msink:libui:0.1.8")
            }
        }
    }
    Is there a way to tell the compiler to export all public functions, or override the list? I tried multiple options (including linker ones), tried removing exports from libui and some other things - nothing helped 😞 I basically want both ui and my own top-level function to be exported.
  • j

    jeggy

    03/06/2023, 10:07 AM
    I'm planning on created a kotlin script which will be compiled to "Native", but I will need a FTP library. Does anyone know of any FTP library that will work for this?
    v
    n
    • 3
    • 5
  • v

    vbsteven

    03/06/2023, 6:59 PM
    This might be a weird question but I wanted to throw it out there anyway to gather ideas: Is it possible/supported to build a klib manually without going the
    cinterop
    route to interpret headers? So manually writing (or generating) the necessary
    @CCall
    functions to call into a native library. Is there a reason why I should not attempt this?
  • s

    Sam

    03/08/2023, 10:58 PM
    Has anyone written a function to get a device's ip address when targeting iOS? I know it can be done by calling the same APIs as used here: https://stackoverflow.com/questions/6807788/how-to-get-ip-address-of-iphone-programmatically Just hoping someone's already done it before I sink time into actually digesting the pain which is objective C 😆
    m
    e
    • 3
    • 5
  • s

    smbd uknow

    03/09/2023, 12:58 PM
    Hi there, We see strange crashes on iOS, maybe someone faced with something similar before. We’re not sure if it’s connected directly with Kotlin/Native, however we see these stack-traces in Firebase and not able to reproduce the issue locally: GC Timer thread
    void kotlin::RepeatedTimer<kotlin::steady_clock>::Run<kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()>(kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()&&) + 4373751076
    4
    
    void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimer<kotlin::steady_clock>::*&&)(kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()&&) noexcept, kotlin::RepeatedTimer<kotlin::steady_clock>*&&, kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()&&), kotlin::ScopedThread::attributes, void (kotlin::RepeatedTimer<kotlin::steady_clock>::*)(kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()&&) noexcept, kotlin::RepeatedTimer<kotlin::steady_clock>*, kotlin::gc::internal::GCSchedulerDataWithTimer<kotlin::steady_clock>::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::function<void ()>)::'lambda'()> >(void*) + 4373751760
    GC thread
    std::__1::invoke_result<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>::type kotlin::ScopedThread::Run<kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2>(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&) + 4373763056
    4
    
    void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2&&), kotlin::ScopedThread::attributes, kotlin::gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(kotlin::mm::ObjectFactory<kotlin::gc::ConcurrentMarkAndSweep>&, kotlin::gc::GCScheduler&)::$_2> >(void*) + 4373768160
    We use Kotlin 1.7.20
    l
    • 2
    • 2
  • v

    vbsteven

    03/11/2023, 9:45 PM
    Is there a way to force cinterop to always use
    strictEnums
    or
    nonStrictEnums
    without using the heuristics mentioned on https://kotlinlang.org/docs/native-c-interop.html#definition-file-hints ?
  • o

    Omico

    03/14/2023, 9:48 AM
    I'm trying to use tdlib in Kotlin Native. Anything wrong with my code?
    kotlin {
        macosX64()
        linuxX64()
        mingwX64()
        targets.withType<KotlinNativeTarget> {
            compilations["main"].cinterops {
                create("tdlib")
            }
        }
    }
    linkerOpts = \
        -ltdactor \
        -ltdapi \
        -ltdclient \
        -ltdcore \
        -ltddb \
        -ltdjson \
        -ltdjson_private \
        -ltdjson_static \
        -ltdnet \
        -ltdsqlite \
        -ltdutils
    
    linkerOpts.mingw = \
        -I"D:\Git\Omico\telegram-bot\TDLib\tdlib\include" \
        -L"D:\Git\Omico\telegram-bot\TDLib\tdlib\lib"
    v
    m
    l
    • 4
    • 18
  • w

    willflier

    03/14/2023, 11:20 AM
    Hello. How to find current executable's path (not working path) on MacOS? I can't find
    _NSGetExecutablePath()
    function in K/N macos target.
    l
    • 2
    • 3
  • b

    Big Chungus

    03/14/2023, 5:07 PM
    Is there any way to register some code to be executed when K/N object is being garbage collected (like java's finalize)? Trying to figure out how to properly dispose of the cinterop pointers that my wrapper classes own.
    l
    k
    +2
    • 5
    • 32
  • v

    vbsteven

    03/15/2023, 7:38 PM
    Any ideas on a good approach to map C bitfields often used as flags in C functions to a nice typesafe (or at least descriptive/discoverable) Kotlin API ? I'm trying to become an API like
    val application = Application("myapp", ApplicationFlags.NONE.or(ApplicationFlags.REPLACE))
    where I want the signature to read something like
    class Application(val name: String, flags: ApplicationFlags)
    So the user does not have to go hunt for random constants.
    k
    • 2
    • 12
  • j

    Jack

    03/16/2023, 12:31 PM
    Hi, is there any up to date sample for collecting code coverage for native? And is it possible to do it inside gradle?
  • c

    Carl Hickman

    03/16/2023, 2:32 PM
    What would be the Kotlin Native way to do what the Java based String.format does?
    l
    e
    • 3
    • 4
  • l

    Landry Norris

    03/16/2023, 6:06 PM
    I’m building a shared object file that will be used by the JVM via JNI. Is it safe to just build it for linuxX64 and linuxArm64, and re-use the same binaries for androidNativeArm64 and androidNativeX64, or will I have to create separate binaries for linux vs. android NDK? Android is built off Linux, so I’d assume the only issue is that I won’t have access to android-specific methods.
    e
    • 2
    • 2
  • d

    David Herman

    03/16/2023, 8:27 PM
    I'm getting
    platform.posix.TIOCGWINSZ
    showing up as undefined on macos. But as far as I can tell, that constant should be supported on the mac platform?
    • 1
    • 5
  • l

    Lucy

    03/17/2023, 1:38 AM
    I'm having a hard time figuring out what the platform APIs expose. Better documentation is really needed for native
  • j

    Jiaxiang

    03/17/2023, 6:23 PM
    When running Kotlin/Native tasks, I’ve been seeing
    Could not initialize class org.jetbrains.kotlin.backend.konan.env.env
    , does anyone know what could be the cause?
  • s

    spierce7

    03/18/2023, 2:49 PM
    I'm having a performance issue on Windows for Kotlin Native. We have a small application in Kotlin Native that interacts with a C library to stream text to us. We provide the library a static c function, and it streams the log to us.
    staticCFunction { cByte, _ ->
                val c = cByte.toInt().toChar()
                print(c)
            }
    The streaming gets backed up and starts to significantly lag on Windows Machines. The same code on Mac seems to perform fine. We've removed the print, and started buffering the characters before we print (so we only print once a line). The issue is still present. The same code in C++ doesn't have the same performance issues. What else could we do to improve performance in Kotlin?
  • s

    Sergey Aldoukhov

    03/20/2023, 2:51 AM
    I’d like to handle arrow keys from the standard input in my Kotlin Native console app (to handle history and current line editing). Is this possible? Maybe some libraries exist to support the use case?
    d
    • 2
    • 5
  • d

    David Herman

    03/20/2023, 5:48 AM
    I know Win7 is past end of life, but I had a report from a user that my K/N program triggered a "The procedure entry point EnumDynamicTimeZoneInformation could not be located in the dynamic link library ADVAPI32.dll" for them on a Win7 machine. Is there any chance that anyone has seen this before? Edit: Probably "solved". Sounds like another dependency, not mine.
    • 1
    • 3
  • d

    Daniel

    03/20/2023, 5:32 PM
    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?
Powered by Linen
Title
d

Daniel

03/20/2023, 5:32 PM
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?
View count: 3