ktor-1.0.0-alpha-1 on ios throw exception on HttpC...
# ktor
a
ktor-1.0.0-alpha-1 on ios throw exception on HttpClient initialization:
Copy code
#1	0x0000000105008340 in ThrowException ()
#2	0x0000000105019b92 in kfun:kotlinx.io.charsets.Charset.Companion.forName(kotlin.String)kotlinx.io.charsets.Charset at /opt/teamcity-agent/work/22e3a7db6b861ba7/kotlinx-io-native/src/main/kotlin/kotlinx/io/charsets/CharsetNative.kt:20
#3	0x00000001050d2082 in kfun:io.ktor.client.response.HttpResponseConfig.<init>()io.ktor.client.response.HttpResponseConfig at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/response/HttpResponseConfig.kt:9
#4	0x00000001050d1fa4 in kfun:io.ktor.client.engine.HttpClientEngineConfig.<init>()io.ktor.client.engine.HttpClientEngineConfig at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/engine/HttpClientEngineConfig.kt:32
#5	0x00000001050d7e25 in kfun:io.ktor.client.engine.ios.Ios.create(kotlin.Function1<io.ktor.client.engine.HttpClientEngineConfig,kotlin.Unit>)io.ktor.client.engine.HttpClientEngine at /opt/teamcity-agent/work/a85294440dc5c6e:1
#6	0x00000001050c4083 in kfun:io.ktor.client.HttpClient(io.ktor.client.engine.HttpClientEngineFactory<#GENERIC_io.ktor.client.engine.HttpClientEngineConfig>;kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#GENERIC_io.ktor.client.engine.HttpClientEngineConfig>,kotlin.Unit>)Generic at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/src/io/ktor/client/HttpClient.kt:29
#7	0x00000001050c3f2f in kfun:io.ktor.client.HttpClient(kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>)io.ktor.client.HttpClient at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/ktor-client-core-ios/src/io/ktor/client/HttpClientIos.kt:8
#8	0x00000001050cfb1a in kfun:io.ktor.client.HttpClient$default(kotlin.Boolean;kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>;kotlin.Int)io.ktor.client.HttpClient at /opt/teamcity-agent/work/a85294440dc5c6e/ktor-client/ktor-client-core/ktor-client-core-ios/src/io/ktor/client/HttpClientIos.kt:5
e
Hi, @alex009. Could you provide your build.gradle configurations? I couldn't reproduce
a
i put configs to issue. if this can't help so i create demo project today
you try on ios?
I forgot to point out that this is precisely iOS
e
Yes. We use HttpClient in kotlin conf app on iOS
a
hmm, i try to clone repo & test
ktor_version=0.9.5-rc13-conf2
in kotlinconf app i see. on what branch kotlinconf used new alpha? @e5l
reason of error was added in https://github.com/ktorio/ktor/commit/1115830397fd762e15a8fb40e684f7eb116bf946 - when create object
HttpResponseConfig
at start
defaultCharset
is set to
Charset.forName("ISO_8859_1")
but on iOS
ISO_8859_1
not exist
this can be fixed by:
Copy code
var defaultCharsetName: String = "ISO_8859_1"
val defaultCharset: Charset 
  get() = Charset.forName(defaultCharsetName)
in this case we can change charsetname before it was called in
Charset.forName
e
Reproduced. The fix would be available soon.
👍 1