Touchlab XCode插件调试KMM项目在XCode不工作



这个插件https://github.com/touchlab/xcode-kotlin不允许通过Xcode调试kotlin代码,文件没有颜色,也没有可能在kotlin文件中添加断点(虽然它是为。swift文件),该怎么办?

  1. 确保您遵循readme:
  2. 中提到的所有步骤。
  • 从GitHub下载项目并运行./setup.sh插件(或./setup-xcode11.sh为新版本https://github.com/touchlab/xcode-kotlin/pull/30/files)
  • 打开Xcode,点击"Show project navigator",创建一个新组(我的在executive-app下)
  • commonMainiosMain文件夹添加到新建的组中

  1. 如果上述步骤仍然没有帮助,请尝试重新启动Xcode,重新启动计算机或删除DerivedData我如何在Xcode 8中删除派生数据?

  2. 重要!如果你有几个Xcode版本或者如果你最近更新了你的Xcode,可能插件不知道你的Xcode UUID。

让插件知道:


  • 手动获取UUID:defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID(如果你有几个版本,它可能会像defaults read /Applications/<howMyXCodeIsNamed>.app/Contents/Info DVTPlugInCompatibilityUUID)

  • 将UUID写入插件信息文件defaultwrite ~/Library/Developer/Xcode/Plug-ins/Kotlin.ideplugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add <UUID from previous step>

或者使用https://github.com/touchlab/xcode-kotlin/pull/29/files来纠正初始脚本,但在此之前请确保您现在使用的Xcode版本是默认的(它可以由sudo xcode-select --switch Applications/path/to/your/xcode设置)