Kotlin Native using 1.0.0-beta-1: I tried to creat...
# ktor
j
Kotlin Native using 1.0.0-beta-1: I tried to create a customized version of the iOS HttpClientEngine. I copied the source code from the original IosClientEngine, added necessary annotations to make it compile but it rises compiler errors: https://gist.github.com/jonasbark/e37d535239ae28facc83bd4ff2c0772a Errors mentioned:
Copy code
> Task :common:linkDebugFrameworkIos
Undefined symbols for architecture arm64:
  "_private_classes_<ktor-client-core-ios>_io.ktor.client.request.DefaultHttpRequest_94", referenced from:
      _kfun:com.stihl.app.module.connect.api.Ios2ClientEngine.execute(io.ktor.client.call.HttpClientCall;io.ktor.client.request.HttpRequestData)io.ktor.client.call.HttpEngineCall in combined.o
  "_private_functions_<ktor-client-core-ios>_kfun:io.ktor.client.request.DefaultHttpRequest.<get-content>()io.ktor.http.content.OutgoingContent_133", referenced from:
      _kfun:com.stihl.app.module.connect.api.Ios2ClientEngine.execute(io.ktor.client.call.HttpClientCall;io.ktor.client.request.HttpRequestData)io.ktor.client.call.HttpEngineCall in combined.o
  "_private_functions_<ktor-client-core-ios>_kfun:io.ktor.client.request.DefaultHttpRequest.<get-headers>()io.ktor.http.Headers_134", referenced from:
      _kfun:com.stihl.app.module.connect.api.Ios2ClientEngine.execute(io.ktor.client.call.HttpClientCall;io.ktor.client.request.HttpRequestData)io.ktor.client.call.HttpEngineCall in combined.o
  "_private_functions_<ktor-client-core-ios>_kfun:io.ktor.client.request.DefaultHttpRequest.<get-method>()io.ktor.http.HttpMethod_131", referenced from:
      _kfun:com.stihl.app.module.connect.api.Ios2ClientEngine.execute(io.ktor.client.call.HttpClientCall;io.ktor.client.request.HttpRequestData)io.ktor.client.call.HttpEngineCall in combined.o
  "_private_functions_<ktor-client-core-ios>_kfun:io.ktor.client.request.DefaultHttpRequest.<get-url>()io.ktor.http.Url_132", referenced from:
      _kfun:com.stihl.app.module.connect.api.Ios2ClientEngine.execute(io.ktor.client.call.HttpClientCall;io.ktor.client.request.HttpRequestData)io.ktor.client.call.HttpEngineCall in combined.o
ld: symbol(s) not found for architecture arm64
I suspect it's because of the DefaultHttpRequest but I have no clue how to work around this. Any idea?
e
The iOS engine is a link-time dependency and the engine symbol name have to be the same for now.
You could resolve it by removing adding
ktor-client-core-ios
and create the method:
Copy code
fun IosClient(): HttpClientEngineFactory<IosClientEngineConfig> = 
  TODO("your implementation")
Could you list your project configuration to clarify the issue?
j
issue persists after removing the ktor-client-core-ios dependency