Arthur Brum
03/06/2020, 9:39 PMld: warning: ignoring file /Users/.../BC_lib Demo/BC_lib.framework/BC_lib, building for iOS-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_KotlinMutableDictionary", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_BC_libPinpadOutput", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_BC_libCommonKt", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_BC_libPinpadCompanion", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
Are there any extra steps that I should do to be able to use my framework when developing to devices (on simulators things work)Artyom Degtyarev [JB]
03/10/2020, 12:17 PMiosArm<64 | 32>
or an iosX64
? On a first sight, it seems like you’re feeding Xcode with incorrect framework. If you are sure that that’s not the problem…
Maybe Xcode cached the simulator framework somewhere inside, and you should clean build folder etc. Check the project folder contents manually and make sure that correct framework is in place.Arthur Brum
03/11/2020, 12:39 AM(...)
def iosTarget = System.getenv('SDK_NAME')?.startsWith('iphoneos') ? presets.iosArm64 : presets.iosX64
fromPreset(iosTarget, 'ios') {
binaries {
framework('BC_lib')
}
}
Artyom Degtyarev [JB]
03/11/2020, 6:23 AMSDK_NAME
manually? Because usually this construction is being used along with some copyFramework
task, to automate the process.Arthur Brum
03/11/2020, 1:27 PMtask packForXCode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
final def framework = kotlin.targets.ios.binaries.getFramework("BC_lib", mode)
inputs.property "mode", mode
dependsOn framework.linkTask
from { framework.outputFile.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)
}
}
}
Simulator-x86_64
I've read somewhere saying that apple don't accept apps which their included frameworks have extra symbols to different archtecture mixed up.
What would be the best way to set this so that I can build to both simulator and device without having to switch framework files?Artyom Degtyarev [JB]
03/11/2020, 1:34 PMFatFramework
, I suppose. See https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#building-final-native-binaries, Building universal frameworks subsection.