Wednesday, October 28, 2026
HomeiOS Developmentandroid - mutation try of frozen io.ktor.shopper.request.HttpRequestPipeline@151ac8

android – mutation try of frozen io.ktor.shopper.request.HttpRequestPipeline@151ac8

[ad_1]

I am utilizing IO Ktor: ktor shopper core to implement multi platform community requests, however I encountered some issues

Once I use the category attribute created by httpclient () and the native variable created by httpclient () within the methodology to name the request interface respectively, the primary methodology will report an error. I do not know what the issue is. Should you can, please assist me

Exception would not match @Throws-specified class listing and thus is not propagated from Kotlin to Goal-C/Swift as NSError.
It's thought-about surprising and unhandled as a substitute. Program will likely be terminated.
Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation try of frozen io.ktor.shopper.request.HttpRequestPipeline@151ac8
    at 0   KmmiOS                              0x0000000102ba7fe4 ThrowInvalidMutabilityException + 200
    at 1   KmmiOS                              0x0000000102ca7390 kfun:io.ktor.util.pipeline.Pipeline.notSharedInterceptorsList#inside + 216
    at 2   KmmiOS                              0x0000000102ca6e90 kfun:io.ktor.util.pipeline.Pipeline.sharedInterceptorsList#inside + 1360
    at 3   KmmiOS                              0x0000000102ca3980 kfun:io.ktor.util.pipeline.Pipeline#execute(1:1;1:0){}1:0 + 388
    at 4   KmmiOS                              0x0000000102cdc5a4 kfun:io.ktor.shopper.HttpClient.$executeCOROUTINE$19#invokeSuspend(kotlin.Outcome<kotlin.Any?>){}kotlin.Any? + 428
    at 5   KmmiOS                              0x0000000102d0d7a4 kfun:io.ktor.shopper.assertion.HttpStatement.$executeUnsafeCOROUTINE$64#invokeSuspend(kotlin.Outcome<kotlin.Any?>){}kotlin.Any? + 884
    at 6   KmmiOS                              0x0000000102d0ca58 kfun:io.ktor.shopper.assertion.HttpStatement.$executeCOROUTINE$61#invokeSuspend(kotlin.Outcome<kotlin.Any?>){}kotlin.Any? + 532
    at 7   KmmiOS                              0x0000000102d0d378 kfun:io.ktor.shopper.assertion.HttpStatement#execute(){}io.ktor.shopper.assertion.HttpResponse + 392
    at 8   KmmiOS                              0x0000000102d77a2c kfun:com.instance.kmmnetworkmodule2.CMTKmmNetwork.$getHtmlCOROUTINE$0#invokeSuspend(kotlin.Outcome<kotlin.Any?>){}kotlin.Any? + 1404
    at 9   KmmiOS                              0x0000000102e1b984 objc2kotlin.1062 + 320
    at 10  KmmiOS                              0x0000000102b86754 $s6KmmiOS14ViewControllerC11viewDidLoadyyF + 1000
    at 11  KmmiOS                              0x0000000102b86b70 $s6KmmiOS14ViewControllerC11viewDidLoadyyFTo + 36
    at 12  UIKitCore                           0x0000000184641568 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 104
    at 13  UIKitCore                           0x0000000184645bb8 -[UIViewController loadViewIfRequired] + 1020
    at 14  UIKitCore                           0x0000000184645f84 -[UIViewController view] + 28
    at 15  UIKitCore                           0x0000000184dd4904 -[UIWindow addRootViewControllerViewIfPossible] + 176
    at 16  UIKitCore                           0x0000000184dd4114 -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 224
    at 17  UIKitCore                           0x0000000184dd4f64 -[UIWindow _setHidden:forced:] + 252
    at 18  UIKitCore                           0x0000000184de5b00 -[UIWindow _mainQueue_makeKeyAndVisible] + 52
    at 19  UIKitCore                           0x000000018502ca7c -[UIWindowScene _makeKeyAndVisibleIfNeeded] + 200
    at 20  UIKitCore                           0x00000001841daafc +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1428
    at 21  UIKitCore                           0x0000000184d950ec -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1280
    at 22  UIKitCore                           0x0000000184d95588 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 300
    at 23  UIKitCore                           0x0000000184869904 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 360
    at 24  FrontBoardServices                  0x000000018614ba84 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 412
    at 25  FrontBoardServices                  0x0000000186177cec __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 + 100
    at 26  FrontBoardServices                  0x000000018615a160 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232
    at 27  FrontBoardServices                  0x0000000186177908 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 312
    at 28  libdispatch.dylib                   0x00000001033f1694 _dispatch_client_callout + 16
dyld4 config: DYLD_ROOT_PATH=/Functions/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Sources/RuntimeRoot DYLD_LIBRARY_PATH=/Customers/2yue8hao/Library/Developer/Xcode/DerivedData/KmmiOS-gbbrsiyqftkmsugfobpnraelllac/Construct/Merchandise/Debug-iphonesimulator:/Functions/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Sources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Functions/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Sources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Functions/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Sources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Functions/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Sources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Customers/2yue8hao/Library/Developer/Xcode/DerivedData/KmmiOS-gbbrsiyqftkmsugfobpnraelllac/Construct/Merchandise/Debug-iphonesimulator
CoreSimulator 783.5 - Gadget: iPhone 13 (47D37E06-9A22-47D8-AAB4-F4FB50DCD7DF) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 13

My dependence:

val commonMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-core:2.0.0")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
            }
        }

If I name like this,The above error will likely be displayed

object CMTKmmNetwork {
    personal var shopper: HttpClient = HttpClient()
    droop enjoyable getHtml(): String {
        val response = shopper.get("https://ktor.io/docs")
        return response.bodyAsText()
    }
}


But when so

object CMTKmmNetwork {
 droop enjoyable getHtml(): String {
        val response = HttpClient().get("https://ktor.io/docs")
        return response.bodyAsText()
    }
}

is okay

Name mode in iOS

import kmmnetworkmodule2
class ViewController: UIViewController {

    @IBOutlet weak var contentLabel: UILabel!
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
        // Do any further setup after loading the view.
        CMTKmmNetwork.shared.getHtml { v1, v2 in
            print(v1)
        }
    }

}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments