簡體   English   中英

KMM 錯誤:此 API 是 ktor 內部的,不應使用。 它可能會被刪除或更改,恕不另行通知

[英]KMM error: This API is internal in ktor and should not be used. It could be removed or changed without notice

將 Xcode 更新到 13.0 后,我無法運行使用 Kotlin Multiplatform 的 iOS 應用程序。
構建失敗, Command PhaseScriptExecution failed with a nonzero exit code ,它說錯誤是:

任務 :shared:compileKotlinIos 失敗
e: /Users...path.../KtorClient.kt: (134, 17): 此 API 是 ktor 內部的,不應使用。 它可能會被刪除或更改,恕不另行通知。

更新到 Xcode 13 后,我們也遇到了類似的錯誤,但它總是與共享 KMM 庫、JDK 等有關……此錯誤多次顯示:
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home/bin/java'' finished with non-zero exit value 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,都沒有任何幫助。

在互聯網上找到的這個命令也沒有幫助(他們說你應該在更新 Xcode 后運行它):

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

這是 Ktor 的一個已知問題,與 Kotlin 中的此修復程序有關。

您可以在共享模塊build.gradle.kts選擇這樣的檢查:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM