Is there anyone who can help me to find out why th...
# kotlin-native
l
Is there anyone who can help me to find out why the method ‘objc_msgSend’ not work in kotlin? Is it a bug for the implementation of kotlin objective-c refection? Please check the link below: https://stackoverflow.com/questions/59407317/platform-objc-objc-msgsend-not-work-in-kotlin
o
How exactly is doesn’t work? People easier help when there’s well defined problem.
l
Sorry for missing the link, I just edit the message, now it looks clearly
o
But what exactly do you mean by “doesn’t work”?
l
Copy code
let userId = framework.create(typeName: typeName, id: "testId")  as! UserId
// ????????  the userId is created sucessful but userId.id is empty, not the expetcting value "testId"
In kotlin code:
Copy code
objc_msgSend(instance, selector, id)
if this method work well, the userId.id should be “testId”
s
Hello! What versions of Kotlin and Xcode do you use?
l
Xcode version: 11.3 (11C29) Kotlin version: 1.3.61
@sergey.bogolepov Hello? Could you help me to resolve this problem? Thank you very much, this issue blocks me for a long long time :(
s
I’m still investigating the problem. As a quick workaround you can implement the
create
function in Objective-C.
o
currently due to internal compiler limitations this scenario cannot be supported from KOtlin side, but feel free to use Sergey's suggestion and implement it on Objective-C side
l
Ok, I see, thank you very much~