Sam
11/23/2018, 3:47 PMcomponents.main {
targets = ['ios_arm64', 'ios_x64']
outputKinds = [KLIBRARY]
baseName = "kotlinmultiplatformstorage-ios"
dependencies {
cinterop("KeychainWrapper"){
packageName "com.netguru.keychainWrapper"
includeDirs {
allHeaders "./KeychainWrapper.framework/Headers"
}
linkerOpts "-F${projectDir}"
}
}
}
As the result I have the following artifacts built:
* kotlinmultiplatformstorage-common
* kotlinmultiplatformstorage-android
* kotlinmultiplatformstorage-ios
* kotlinmultiplatformstorage-ios_debug_ios_arm64
* kotlinmultiplatformstorage-ios_debug_ios_x64
Next, I’m trying to use in the sample app configured using kotlin-multiplatform
plugin with the following gradle build script:
plugins {
id 'kotlin-multiplatform' version '1.3.0'
}
kotlin {
targets {
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
fromPreset(presets.android, 'android')
fromPreset(presets.iosArm64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
configurations {
compileClasspath
}
task packForXCode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = System.getenv('CONFIGURATION')?.toUpperCase() ?: 'DEBUG'
inputs.property "mode", mode
dependsOn kotlin.targets.ios.compilations.main.linkTaskName("FRAMEWORK", mode)
from { kotlin.targets.ios.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
into frameworkDir
doLast {
new File(frameworkDir, 'gradlew').with {
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
setExecutable(true)
}
}
}
}
tasks.build.dependsOn packForXCode
When building sampleapp project I’m having the following error thrown:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_Keychain", referenced from:
objc-class-ref in combined.o
ld: symbol(s) not found for architecture arm64
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Do you have any idea what can possibly be wrong with this config?Sam
11/23/2018, 4:04 PMlanguage = Objective-C
headers = Keychain.h KeychainQuery.h KeychainWrapper.h
compilerOpts = -framework KeychainWrapper
Sam
11/23/2018, 7:44 PMlinkerOpts
line.