Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KMM iOS mismatch type ChallengeHandler

Type mismatch: inferred type is ChallengeHandler /* = (NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, (NSURLSessionAuthChallengeDisposition /* = Long */, NSURLCredential?) -> Unit) -> Unit */ but ChallengeHandler /* = (NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge, (NSURLSessionAuthChallengeDisposition /* = Int */, NSURLCredential?) -> Unit) -> Unit */ was expected

Basically above error logs happen when migrate to latest client ktor 2.0.3 and using kotlin 1.7.10.

Is this a bug from ktor? how can we deal with this issue? should we just postponed update latest ktor until this issue fixed?

I think platform.darwin.NSInteger is recognized as Long, thus it got mismatch. when you search inside NSURLSessionAuthChallengeDisposition this is platform.darwin.NSInteger but somehow IDE recognized as Long not Int, so I guess this is a bug? Run the build also failure by same error above

Can't do anything. tried to create extension to use Int, still same.. Tried to cast manually to Int also still error.

Can't build too because of this error.

Anyone have solutions?

enter image description here

like image 247
Yoseph Wijaya Avatar asked Sep 17 '25 11:09

Yoseph Wijaya


1 Answers

enter image description here This can actually compiles just fine on native iOS. Should just ignore the error and provide an explanation in the comments section.

like image 108
Sandy Akbar Avatar answered Sep 19 '25 07:09

Sandy Akbar