some strange errors in K/N target IOS string forma...
# multiplatform
l
some strange errors in K/N target IOS string format. when i format string in this way:
Copy code
"id:$id,error:$error"
i got error in runtime.both of them are object pass by ios framework callback. the second way is fine:
Copy code
"id:" + id +",error:" + error
a
Hi! Can you share a code snippet?
l
Copy code
dispatch_async(dispatch_get_main_queue()) {
    wkWebview.evaluateJavaScript(";window.Native2JSBridge && Native2JSBridge._handleMessageFromApp($jsCode);") { id, error ->
        LogUtil.d("WebView", "id:$id,error:$error")
    }
}
inside the LogUtil.kt:
Copy code
actual fun d(tag: String, msg: String) {
    if (LOG_LEVEL > DEBUG) {
        return
    }
    NSLog("D/$tag : $msg")
}
the error occur on the NSLog call
a
Thanks, can you extend the report with a crash log or something?
l
its magical. i recompile for give u the crash log. the error just gone🤣
🧙‍♂️ 1
a
That’s fine, I also just build this code successfully. Just save the error code next time, okay? 🙂
l
again. not only this case. It will appear randomly wherever toString is used
a
Okay, please try to list all details about the situation - what kotlin version are you using here? Is this appearing for simulator or device targets, is it a debug or release framework etc. IIRC, you can also copy complete stacktrace from Xcode. If it’s possible, post it here too.
l
simulator, debug, kotlin_version = '1.3.61', serialization_version = "0.14.0",i dont know how to get the stacktrace from Xcode, i just get this view
look like wild pointer
a
Please try to get complete stack trace somehow like here. Also, it would be helpful to have a project shared - the last screen can possibly be a bug.
l
Is Kotlin/native toString() equal to Swift description? igot so many problem when i use JsonObject in kotlinx.serialization. idont know is my fault or the compiler or the serialization. Now all I can see is the .h file,i dont know how to debug it
I think the reason for the problem is that the compiler has a problem compiling JsonObject. Declare JsonObject as JsonElement type when used, and it now works https://github.com/Kotlin/kotlinx.serialization/issues/759