gpt4 book ai didi

ios - KMM 错误 : This API is internal in ktor and should not be used. 它可能会被删除或更改,恕不另行通知

转载 作者:行者123 更新时间:2023-12-05 02:38:23 25 4
gpt4 key购买 nike

将 Xcode 更新到 13.0 后,我无法运行使用 Kotlin Multiplatform 的 iOS 应用程序。
构建失败,Command PhaseScriptExecution failed with a nonzero exit code,它表示错误是:

Task :shared:compileKotlinIos FAILED
e: /Users...path.../KtorClient.kt: (134, 17): This API is internal in ktor and should not be used. It could be removed or changed without notice.

我们在更新到 Xcode 13 后也遇到了类似的错误,但它总是与共享 KMM 库、JDK 等有关......这个错误多次出现:
> Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin/java’' 以非零退出值 1 结束

KtorClient.kt的第134行:

override suspend fun createPassword(email: String, password: String): CreatePasswordResponse {
return client.post {
url {
path("v1", "user", "create_password")
body = LoginRequest(email, password)
}
headers {
/*134.line*/ append(HttpHeaders.ContentType, ContentType.Application.Json)
}
}
}

我们已尝试删除 XCWorkspacePodfile.lock、Pods 文件夹,然后重新安装 pod,删除派生数据,但无济于事。

我们也尝试了不同版本的 Ktor、JDK,但没有任何帮助。

此外,在 Internet 上找到的这个命令也没有帮助(他们说你应该在更新 Xcode 后运行它):

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

最佳答案

这是一个 known issue Ktor,与this fix有关在 Kotlin 中。

这是documentation说:

Note that the StringValuesBuilder class that exposes the append function is incorrectly marked with the InternalAPI annotation. This issue will be fixed in v2.0.0. As a workaround, you can add the @OptIn(InternalAPI::class) annotation to explicitly opt-in to use this API.

您可以使用 @OptIn(InternalAPI::class) 选择加入您的特定行,或将其添加到您的共享模块 build.gradle.kts 中以生效在整个模块上:

kotlin {
// ..
sourceSets {
all {
languageSettings.optIn("io.ktor.util.InternalAPI")
}
// ...
}
}

关于ios - KMM 错误 : This API is internal in ktor and should not be used. 它可能会被删除或更改,恕不另行通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69626324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com