我猜您最终希望将依赖项导出到二进制文件。但是,我不确定这是否适用于 Kotlin 模块之间的依赖关系。对于它们之间的依赖关系,我建议使用api
依赖关系链接并为每个模块单独添加 pod。
我的意思是,核心模块的 build.gradle.kts 应该只包含
...
kotlin {
ios()
cocoapods {
ios.deploymentTarget = "13.5"
summary = "CocoaPods test library"
homepage = "https://github.com/JetBrains/kotlin"
pod("FBSDKCoreKit")
}
}
...
login 模块同时具有 cocoapods 和核心依赖项:
...
kotlin {
ios()
framework {
// Mandatory properties
// Configure fields required by CocoaPods.
summary = "Some description for a Kotlin/Native module"
homepage = "Link to a Kotlin/Native module homepage"
// Framework name configuration. Use this property instead of deprecated 'frameworkName'
baseName = "MyFramework"
// Optional properties
// (Optional) Dynamic framework support
isStatic = false
// (Optional) Dependency export
export(project(":core"))
transitiveExport = true
// (Optional) Bitcode embedding
embedBitcode(BITCODE)
}
pod("FBSDKCoreKit")
pod("FBSDKLoginKit")
}
...
sourceSets {
val iosMain by getting {
dependencies {
api(project(":core"))
}
}
}
}
...