Sunday, November 8, 2026
HomeiOS Developmentkotlin - KMM iOS HttpClient NSURLSessionAuthChallengeDisposition kind error difficulty

kotlin – KMM iOS HttpClient NSURLSessionAuthChallengeDisposition kind error difficulty

[ad_1]

I’m nonetheless new to KMM and need assistance on httpClient to disregard ssl certificates. I had made the request in a position to ignore ssl certificates by including the next code to HTTPClient Android Engine:

HTTPClient(Android){
    engine{
        sslManager = {
                httpsURLConnection ->
            httpsURLConnection.hostnameVerifier = HostnameVerifier { _, _ -> true }
                httpsURLConnection.sslSocketFactory = sslContext.socketFactory
        }
    }
}

and on iOS Engine:

HTTPClient(Ios){
    engine{
        handleChallenge { session, job, problem, completionHandler ->
                completionHandler(NSURLSessionAuthChallengeUseCredential, null)
        }
    }
}

Nonetheless, I’ve a difficulty on iOS aspect. NSURLSessionAuthChallengeUseCredential regardless of inheriting from NSURLSessionAuthChallengeDisposition is a kind of Kotlin.Lengthy, however the completion handler’s first param solely take NSURLSessionAuthChallengeDisposition which is a kind of platform.darwin.NSInteger.

At first, i believed to simply convert NSURLSessionAuthChallengeUseCredential to Int or platform.darwin.NSInteger. It didn’t triggered any error at android studio, however as soon as i construct it from xcode the next error pops up:

Sort mismatch: inferred kind is Int however
NSURLSessionAuthChallengeDisposition /* = Lengthy */ was anticipated

I feel this can be a bug as a result of the xcode count on NSURLSessionAuthChallengeDisposition to be a protracted worth, whereas kmm settle for kind of platform.darwin.NSInteger.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments