Hi All, I need help with debugging common Kotlin c...
# kotlin-native
a
Hi All, I need help with debugging common Kotlin code in Xcode. I'm using Xcode 11.2.1 (I also have 10.3 installed, but 11 is the default), Kotlin 1.3.61, I have latest Xcode plugin installed from https://github.com/touchlab/xcode-kotlin, I have synced Kotlin sources via co.touchlab.kotlinxcodesync plugin, so I can see sources in Xcode and set break points, but they don't work, all code is built locally
k
Hmm. If you can set breakpoints it should catch. I'd say kill and restart xcode, then do a clean build.
a
doesn't help
This is how breakpoints show up in Xcode, does it matter if it says
unknown line ***
k
Unknown line is ok. Will poke around. The "plugin" doesn't do a whole lot. Xcode tells lldb what lines to break on, so debugging depends on the compiler output
a
This is my build.gradle
Copy code
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlinx-serialization'
apply plugin: 'org.jetbrains.kotlin.native.cocoapods'
apply plugin: 'com.android.library'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'co.touchlab.kotlinxcodesync'

// CocoaPods requires the podspec to have a version.
version = "0.0.1"

android {
    ...
}

kotlin {
    android()
    iosX64("ios")
    sourceSets {
        commonMain {
            dependencies {
                ...
            }
        }
        commonTest {
            dependencies {
                ...
            }
        }
        androidMain {
            dependencies {
                ...
            }
        }
        androidTest {
            dependencies {
                ...
            }
        }
        iosMain {
            dependencies {
                ...
            }
        }
        iosTest {
        }
    }

    cocoapods {
        // Configure fields required by CocoaPods.
        summary = "Native library"
        homepage = "<https://github.com/>..."
    }
    xcode {
        projectPath = "../iosApp/iosApp.xcodeproj"
        target = "iosApp"
    }
}

sqldelight {
    FinanzeDb {
        packageName = "common.domain.db"
    }
}
k
You’re right. Something’s going on. I haven’t done much debugging with the 1.3.61 release. Will look into that in the morning.
a
Awesome, thank you
k
Odd. Results so far. One project does not catch breakpoints, but I just tried a new project from scratch and it does. Working on what’s different
So. It seems like using cocoapods is part of this. Investigating more
By that I mean I created a very simple sample project from the intellij template, without cocoapods, and the debugger worked. Same project with cocoapods, and no debugging. No other changes.
a
Thanks for the update. I will try to set it up without cocoapods for now.