我使用Kotlin /本地示例代码
https://github.com/kotlin/web-site-samples/archive/mpp-kn-shared-lib-groovy-macos.zip
构建然后获取“ libnative.dylib”
但是
在我的IOS项目中 如何使用?
下面是我的步骤:
Create Module/module.modulemap
module MyLib [extern_c] {
header "libnative_api.h"
export *
}
and put libnative.dylib in here
add Build Setting > Swift Compiler - Search Paths > Import Path
${SRCROOT}/Module
import MyLib
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let aa = MyLib.libnative_ExportedSymbols.init()
let cc = aa.kotlin.root.example.strings("IOS")
获取错误:
致命错误:在隐式展开可选值时意外发现nil