简体   繁体   English

如何使用 Xcode 在 iOS 上调试 Kotlin

[英]How debug Kotlin on iOS with Xcode

Currently I am working on one KMM project.目前我正在从事一个 KMM 项目。 It would be really useful to be able to debug the shared code which is in kotlin in xcode project.能够调试 xcode 项目中 kotlin 中的共享代码将非常有用。 I am aware of this solution but I have problem to tell Xcode that *.kt files are source files我知道这个解决方案,但我无法告诉 Xcode *.kt 文件是源文件

to be more specific in the above github link it is written:在上面的 github 链接中更具体地说,它是这样写的:

You need to tell Xcode that *.kt files are source files, and run an lldb formatter script when debugging starts.您需要告诉 Xcode *.kt 文件是源文件,并在调试开始时运行 lldb 格式化程序脚本。 Advanced users may want to do this manually, but if you have Xcode installed in the default place, you can run the setup script.高级用户可能希望手动执行此操作,但如果您在默认位置安装了 Xcode,则可以运行安装脚本。 Unless you're using Xcode 11 (in which case look here for help), the following script will install both debugging and formatting support:除非您使用的是 Xcode 11(在这种情况下请在此处寻求帮助),否则以下脚本将同时安装调试和格式化支持:

./setup.sh ./setup.sh

I do not know where and how I should run the./setup.sh or if there is another way to do it?我不知道应该在哪里以及如何运行 ./setup.sh 或者是否有其他方法可以运行?

The setup script is included in the github repository: https://github.com/touchlab/xcode-kotlin/blob/main/setup.sh设置脚本包含在 github 存储库中: https://github.com/touchlab/xcode-kotlin/blob/main/setup.sh

The above plugin is great if you want to debug on Xcode and I highly recommend it.如果你想在 Xcode 上调试,上面的插件很棒,我强烈推荐它。 Just an FYI, in case you didn't notice, there is also a plugin for debugging shared code on iOS for Android Studio: https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile仅供参考,以防万一您没有注意到,iOS 上还有一个用于调试 Android Studio 共享代码的插件: https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM