Hey guys, I installed <touchlab/xcode-kotlin> for ...
# touchlab-tools
l
Hey guys, I installed touchlab/xcode-kotlin for debugging Kotlin code from iOS. the installation seems successful, but Xcode is not hitting the breakpoint for some reason. I set the breakpoint in my
commonMain
I also see
Stop hook #1 added
in Xcode log. The Xcode Project navigation says
Unknown ID
for the break point. what am I missing
this is the output of
xcode-kotlin info
Copy code
Installed plugin version:       2.0.0
Bundled plugin version:         2.0.0

Language spec installed: Yes
LLDB init installed: Yes
LLDB Xcode init sources main LLDB init: No

Installed Xcode versions:
✔       Xcode 15.4 (15F31d)     null    /Applications/Xcode.app

✔ - plugin is compatible, x - plugin is not compatible
Run 'xcode-kotlin sync' to add compatibility for all listed Xcode versions.
t
Hi, how do you build the code? Do you build it on you machine? If so, when you added the Kotlin code to Xcode, did you make sure not to copy the files but just link them in place?
The breakpoint is just outlined because it’s telling you it cant find it in the binary
l
yes, I built the code on my machine. i have an existing KMM project and i added the debugging library by following the documentation. yes, i linked the KMM project as the documentation says
t
Can you try placing the breakpoint somewhere else, like a very simple function with no suspending or nothing? Usually this happens when you copy the files into your iOS project instead of linking them in place. Are you building debug?
l
i tried it on non suspending function, still having the same issue. yes, this is debug mode
t
Can you share the project or a reproducer?
l
this is my own private project. i will create another sample project and see if it works there soon. thank you!
👍 1
j
@Loe I replied in the other thread, but this works for me just fine today. I did restart Xcode. Maybe Xcode needs to reindex the files in your project? Perhaps try to delete derived data if that don't work try deleting Xcode caches to force a reindex.
👍 1
l
@Tadeas Kriz i'm trying to replicate the issue on imageviewer KMM sample app, but i'm not even getting the option to create
new Group
I get this option on my other project, but not this one
t
You need to right click on the project
l
t
Yeah
But you should just use “add files to iosapp”
And make sure “copy if needed” is unchecked
j
I think this works better if your using a workspace and not a project. When you use workspace you can create folder at the same level of the project and add a folder reference to the shared code. This is what my workspace looks like, I reference the entire shared folder to debug all the kotlin code from Xcode. Just make a new workspace and save at the project root level. Drag the iosApp.xcodeproj into it and then drag the shared folder into it, or any other folder which has your kotlin files you want to debug.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:shared">
</FileRef>
<FileRef
location = "group:iosApp/iosApp.xcodeproj">
</FileRef>
</Workspace>
l
Thanks Jason!
debugging works on the sample project but not on my own project. i'm doing the same exact thing so i don't know what's happening
t
Can you record a screenshare of how you're adding the Kotlin files to Xcode in your project and share it with me in DM?
l
it even worked on another sample project. my issue is probably Xcode build settings. i can't share my company's project so i will try to figure this out in the future. Thanks for all the help!
👍 1
@Tadeas Kriz i'm getting this warning after the latest Xcode update. do you know if i need to configure something based on this: warning: (arm64) /Users/leo/Library/Developer/Xcode/DerivedData/Vix-gsjruzwlqercfsj/Build/Products/Debug-iphoneos/MyTest.app/MyTest empty dSYM file detected, dSYM was created with an executable with no debug info.
t
I'm not sure if this is SKIE or Kotlin/Native's doing. I'd expect this is Kotlin/Native though
👍 1
l
Okay, thanks
I ended up recreating my entire KMM project and the debugger is working now. it rarely breaks because of Xcode and recloning the project helps. no more debugging backend with print statements lol. Thank you for all the help🙏😺
🙌 1