I’m having a very annoying issue that I can’t seem...
# kotlin-native
y
I’m having a very annoying issue that I can’t seem to debug. I keep getting an exception everytime i try to check equality of 2 kotlin native objects on iOS. The debugger isn’t giving me much helpful information which parameter it’s struggling to equate. Here is a github link: https://github.com/yusufcareem/KotlinNativeTestApp
k
I cloned your app. Might be my lack of understanding, but where does the 'fake' call go?
y
The fake objects are in
Mocks.swift
in the unit test target
k
OK. For debugging, in xcode, there's definitley room for improvement on the tooling side. I'd create local instance of those objects so you can breakpoint and look at them in the debugger. I don't think that has anything to do with the issue, but if you want to look at them, that's what I'd do. I'm sure this has something to do with XCTAssertEqual is expecting an object equality comparison that isn't generated in the kotlin code, but this is definitely out of my wheelhouse.
y
I’ve eliminated it to the 1 paramter
It crashes when you compare 2
Int?
k
Crashes or fails? Also, my point is I don't think there's an equality comparison defined by kotlin that swift knows how to call, although again, out of my wheelhouse
y
It crashes due to an exception thrown by the kotlin compiler
k
Compiler or runtime? Also, post exception
y
Copy code
KotlinNativeFramework`kfun:konan.internal.ThrowInvalidReceiverTypeException(kotlin.reflect.KClass<#STAR>)kotlin.Nothing:
s
It crashes because it expects
<http://kotlin.Int|kotlin.Int>
(= Swift’s
Int32
), but you pass
kotlin.Long
. To workaround the issue, you can use
customerIdType: 0 as Int32 as NSNumber
instead of
customerIdType: 0
and
UserSurge: 0.0
instead of
UserSurge: 0
y
Ah okay
thankyou!
Really appreciate your guys help 🙂
I can confirm it works
s
Thank you, I’m glad to know this 🙂