按照有关如何在 KMP 项目中支持 cocoapods 的官方文档,即使在示例应用程序上,您最终也会收到错误:
FAILURE: Build failed with an exception.
* What went wrong:
'embedAndSign' task can't be used in a project with dependencies to pods.
Please migrate to CocoaPods for integration into Xcode: https://kotl.in/vc2iq3
To temporarily suppress this error, put the following in your gradle.properties:
上面的链接是官方文档: https://kotlinlang.org/docs/native-cocoapods-xcode.html#xcode-project-with-one-target
但他们错过了解决方案。
我期待看到构建运行。
终于找到答案了。很简单,但没有任何地方提到...
只需在任何编辑器中打开 xcode 项目文件即可
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n";
放
shellScript = "";
您可以通过 xcode UI 执行相同的操作,但这样做要快得多。
此脚本是由于直接集成而存在的剩余脚本(默认情况下在所有示例中):https://kotlinlang.org/docs/multiplatform-direct-integration.html