Ktor native does not work with Xcode
See original GitHub issueKtor Version and Engine Used (client or server and name)
io.ktor:ktor-client-core-native:1.2.4
Describe the bug When I start project for IOS Xcode generate next exception:
Instances of kotlin.Error, kotlin.RuntimeException and subclasses aren't propagated from Kotlin to Objective-C/Swift.
Other exceptions can be propagated as NSError if method has or inherits @Throws annotation.
Uncaught Kotlin exception: kotlin.IllegalStateException: Failed to find HttpClientEngineContainer. Consider adding [HttpClientEngine] implementation in dependencies.
at 0 SharedCode 0x0000000107a42e35 kfun:kotlin.Exception.<init>(kotlin.String?)kotlin.Exception + 85
at 1 SharedCode 0x0000000107a41fb5 kfun:kotlin.RuntimeException.<init>(kotlin.String?)kotlin.RuntimeException + 85
at 2 SharedCode 0x0000000107a424f5 kfun:kotlin.IllegalStateException.<init>(kotlin.String?)kotlin.IllegalStateException + 85
at 3 SharedCode 0x0000000107c53dce kfun:io.ktor.client.HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>)io.ktor.client.HttpClient + 526
at 4 SharedCode 0x0000000107c54042 kfun:io.ktor.client.HttpClient$default(kotlin.Function1<io.ktor.client.HttpClientConfig<#STAR>,kotlin.Unit>;kotlin.Int)io.ktor.client.HttpClient + 290
at 5 SharedCode 0x0000000107c7d9f5 kfun:com.jetbrains.handson.mpp.mobile.GitHubApiClient.<init>(kotlin.String;kotlin.String)com.jetbrains.handson.mpp.mobile.GitHubApiClient + 341
at 6 SharedCode 0x0000000107c9b482 blockCopyHelper + 370
at 7 KotlinIOS 0x00000001076fdb62 $sSo25SharedCodeGitHubApiClientC14githubUserName0G8PasswordABSS_SStcfC + 66 (/Users/olegmusenko/AndroidStudioProjects/mpp-ios-android/native/KotlinIOS/<compiler-generated>:<unknown>)
at 8 KotlinIOS 0x00000001076fd71a $s9KotlinIOS14ViewControllerC11viewDidLoadyyF + 1242 (/Users/olegmusenko/AndroidStudioProjects/mpp-ios-android/native/KotlinIOS/KotlinIOS/ViewController.swift:14:44)
at 9 KotlinIOS 0x00000001076fdcb4 $s9KotlinIOS14ViewControllerC11viewDidLoadyyFTo + 36 (/Users/olegmusenko/AndroidStudioProjects/mpp-ios-android/native/KotlinIOS/<compiler-generated>:<unknown>)
at 10 UIKitCore 0x000000010c5690f7 -[UIViewController loadViewIfRequired] + 1183
at 11 UIKitCore 0x000000010c569524 -[UIViewController view] + 27
at 12 UIKitCore 0x000000010cba222b -[UIWindow addRootViewControllerViewIfPossible] + 122
at 13 UIKitCore 0x000000010cba291f -[UIWindow _setHidden:forced:] + 289
at 14 UIKitCore 0x000000010cbb557e -[UIWindow makeKeyAndVisible] + 42
at 15 UIKitCore 0x000000010cb6533c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
at 16 UIKitCore 0x000000010cb6a4e6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
at 17 UIKitCore 0x000000010c3aea4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
at 18 UIKitCore 0x000000010c3b7346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
at 19 UIKitCore 0x000000010c3ae664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
at 20 UIKitCore 0x000000010c3aefc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
at 21 UIKitCore 0x000000010c3ad332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
at 22 UIKitCore 0x000000010c3acfe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
at 23 UIKitCore 0x000000010c3b1d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
at 24 UIKitCore 0x000000010c3b2988 _performActionsWithDelayForTransitionContext + 100
at 25 UIKitCore 0x000000010c3b1a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
at 26 UIKitCore 0x000000010c3b6a48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
at 27 UIKitCore 0x000000010cb68dc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
at 28 UIKitCore 0x000000010c72002f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
To Reproduce
Task packForXcode
builds success and Android project works fine. Xcode project builds fine too, but have runtime exception.
ext.kotlin_version = '1.3.50'
Dependencies:
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
MacOS Kmp cannot install ktor dependency - Stack Overflow
Working with Kotlin KMP and targeting macos and I am having trouble installing a ktor dependency. Here is my shared module gradle file...
Read more >The Precarious Problem of Kotlin Multiplatform on iOS - Medium
Kotlin/Native does not support Swift, only Objective-C. This includes both inputs (dependencies) and outputs. The tool used to support Apple ...
Read more >shared Module, No Longer Build for iosApp in AS, But Work ...
"As a temporary workaround, you can just disable the iosSimulatorArm64 part of your build until Ktor 2.0.0 will be released." Could u plz...
Read more >Native server | Ktor
Native server Ktor supports Kotlin/Native and allows you to run a server without an additional runtime or virtual machine. Currently, running a Ktor...
Read more >Ktor and kotlinx dependencies not found when building iOS ...
Make sure enableFeaturePreview("GRADLE_METADATA ") is in the settings.gradle file. Once I added this line, I was able to compile from Xcode. Spencer ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have added
io.ktor:ktor-client-ios
to dependencies and it is works. Thanks.Not exact. The
ktor-client-core-ios
became the core part fornative
and we renamed it toktor-client-core-native
. Thektor-client-ios
is the ios engine, and the name stays the same.