Thread
#multiplatform
    t

    Tarika Chawla

    1 year ago
    Hi all, Anyone has any experience integrating a KMM in a Development Pod in iOS instead of the project itself? I was able to import the KMM in the development pod by adding it through podspec file but hitting a roadblock when I call those functions.
    louiscad

    louiscad

    1 year ago
    Hi, what is the roadblock you're hitting?
    t

    Tarika Chawla

    1 year ago
    I have an app which uses that Development pod. When I run the app which further calls the function in the development pod (which has the KMM function), the app just crashes.
    Right now, I am adding the KMM to the library like this:1. Project file: Add the path the podspec file generated by KMM gradle 2. run pod install 3. It added the KMM module as a cocoapod int he development pod folder 4. Then I referred to that development pod in the podspec file of my ios library (development pod) this way:
    s.dependency 'accesstokenmodule'
    louiscad

    louiscad

    1 year ago
    What's the crash cause exactly?
    The logs should show why the crash happens.
    t

    Tarika Chawla

    1 year ago
    There is no error. It just goes to memory management with this
    Kotlin_ObjCExport_toKotlinSelector
    This is consistent with any function I tried calling which is in that Kotlin module.
    There are no logs at all. thats why its so hard to track down a solution I guess.
    louiscad

    louiscad

    1 year ago
    I'd try to get another pod to work, starting from the Cocoapods Kotlin doc, or from an official sample, and once I get it working, I'd look at how the setup is different with what crashes
    t

    Tarika Chawla

    1 year ago
    Just one thing though. When I try to call a function in the app instead of a development pod from this same KMM. the app works and there is no crash
    My first assumtpion was maybe KMM only supports integration with an ios app and not in the development Pod?
    louiscad

    louiscad

    1 year ago
    The first call to Kotlin code from the pod crashes, did I understand correctly?
    t

    Tarika Chawla

    1 year ago
    yup, from the pod it crashes! But same thing from the app, it doesnt crash?
    louiscad

    louiscad

    1 year ago
    It's very possible it's not supported. I'd ask @akapanina to be sure.
    t

    Tarika Chawla

    1 year ago
    hmm okay. Thank you so much for looking into it and guiding me ahead 🙂 I really appreciate it.
    Just an update, We were able to resolve the issue. It looks like the integration with the development pod is possible. The only thing to take care of is that the KMM is available by the time we try to instantiate it. As an example, if my KMM has a
    class Foo
    with a function
    getFooString()
    . I need to make sure that by the time I instantiate the Foo class as private let foo = Foo()the KMM module should be loaded. More like a race condition. In order to solve it, we added
    private lazy var
    instead of using
    private let
    when instantiating the class the very first time. So we wait till we need to use it in the hope that it will be available by then.
    louiscad

    louiscad

    11 months ago
    Great that you found the solution! What do you call the "KMM" exactly?
    t

    Tarika Chawla

    11 months ago
    Kotlin Multiplatform Module
    louiscad

    louiscad

    11 months ago
    FYI, KMM stands for Kotlin Multiplatform Mobile, hence my request for clarification 🙂
    t

    Tarika Chawla

    11 months ago
    ahh okay! Thank you 🙂