I need to pass a `kotlinx.cinterop.CPointer<kot...
# kotlin-native
r
I need to pass a
kotlinx.cinterop.CPointer<kotlinx.cinterop.ObjCObjectVar<platform.Foundation.NSError?>>?
to an ObjC function, is it how you do it?
Copy code
var error: NSError? = null
    val errorPtr = ObjCObjectVar<NSError?>(error.objcPtr()).ptr
👍 1
Also, let’s say that works. I get a NSError instance. I can’t throw that. Is there still no built-in way to convert from NSError to Throwable (and vice-versa) ?
r
Is what I did equivalent? I’m going to change to using
alloc
but I still wonder
s
let’s say that works.
I’m afraid it doesn’t.
Is there still no built-in way to convert from NSError to Throwable (and vice-versa) ?
Does anything prevent you from throwing an exception with
NSError
inside?
Is what I did equivalent?
No.
r
I don’t know much about native, I just wanted to try and transfer the stacktrace from one error type to the other, assuming there is one, but I don’t think there is one. I just did
throw Error("...: ${nsError.debugDescription}")
s
NSError
doesn’t have a stacktrace.
👍 1
k
exceptions are not how errors are handled in Objective-C, hence no stack trace
297 Views