https://kotlinlang.org logo
#ios
Title
# ios
s

Steve Young

10/07/2019, 1:39 PM
is this the right way to declare the hidden method? @kotlinx.cinterop.ObjCMethod(“”, “”) external fun NSURLRequest.Companion.setAllowsAnyHTTPSCertificate(allow: Boolean, host: NSString):kotlin.Unit
s

svyatoslav.scherbina

10/08/2019, 7:32 AM
Please don’t use
@ObjCMethod
and/or
external
, it is not intended to be used in source code. If I understand you correctly, adding
cinterop
configuration with
.def
file containing Objective-C category declaration should help.
s

Steve Young

10/08/2019, 10:06 PM
How to make cinterop convert objc code? Is there a sample project?
s

svyatoslav.scherbina

10/09/2019, 6:41 AM
Please refer to the documentation, for example: https://kotlinlang.org/docs/tutorials/native/curl.html Use something like
Copy code
language = Objective-C
---
@interface MyClass (MyCategory)
// ...
@end;
as
.def
file. In this case you don’t need `headers`/`linkerOpts`/whatever.
s

Steve Young

10/09/2019, 4:51 PM
Thanks, @svyatoslav.scherbina got it to compile
3 Views