Jea*_*héo 5 ios kotlin cocoapods kotlin-native
我正在尝试在私有CocoaPod中添加使用Kotlin/Native构建的销售框架,但是我收到错误:
pod repo push myCocoapodsRepo myProject.podspec --verbose"[iOS] xcodebuild: fatal error: lipo: input file (/Users/jeandaube/Library/Developer/Xcode/DerivedData/App-auugdpsmbbpvarfzghxatkvwftsn/Build/Products/Release-iphonesimulator/App.app/Frameworks/MyProject.framework/MyProject) must be a fat file when the -remove option is specified
我是否应该以某种方式改变我首先使用Konan导出框架的格式?
您收到错误是因为默认情况下,Kotlin Native仅为单个体系结构生成二进制文件.CocoaPods尝试将其视为具有多种体系结构的"胖"二进制文件时失败.因为你无论如何都需要多个架构(至少arm64用于设备而x86_64用于模拟器)我正在使用的方法是创建两个架构然后将它们合并lipo .然后可以通过CocoaPods 提供生成的胖框架或者只是拖动/ drop安装在Xcode中.
def outputDirectory = "$export_dir/$projectName/$projectVersion"
def outputFramework = "$outputDirectory/${projectName}.framework"
konanArtifacts {
// Declare building into a framework, build arm64 for device, x64 for simulator
framework(projectName, targets: ['ios_arm64', 'ios_x64' ]) {
// The multiplatform support is disabled by default.
enableMultiplatform true
}
}
// combine original arm64 and x64 libraries into a single library in
// the exported framework folder
task combineArchitectures(type: Exec, dependsOn: compileKonanLibrary) {
executable 'lipo'
args = [
'-create',
'-arch',
'arm64',
new File(compileKonanLibraryIos_arm64.artifact, 'Library'),
'-arch',
'x86_64',
new File(compileKonanLibraryIos_x64.artifact, 'Library'),
'-output',
"$outputFramework/Library"
]
}
// export the arm64 (doesn't matter which really) framework, skipping
// the library binary itself
task exportFramework(type: Copy, dependsOn: compileKonanLibrary) {
from compileKonanLibraryIos_arm64.artifact
into outputFramework
exclude projectName
finalizedBy combineArchitectures
}
// build a pod spec by copying and updating a template file
task exportPodspec(type: Copy) {
from "Library.podspec"
into outputDirectory
filter {
it.replaceAll('@@projectName@@', projectName)
.replaceAll('@@projectVersion@@', projectVersion)
}
}
task export {
dependsOn "exportFramework"
dependsOn "exportPodspec"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
944 次 |
| 最近记录: |