首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >KMM Cocoapods出口(M1) Mac

KMM Cocoapods出口(M1) Mac
EN

Stack Overflow用户
提问于 2021-10-01 07:34:08
回答 1查看 1.2K关注 0票数 2

因此,我试图将我的KMM项目导出为iOS框架。

这是我的build.gradle.kts

代码语言:javascript
复制
kotlin {
   android()
   ios()
   sourceSets {
    val commonMain by getting {
        dependencies {
            implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.0-RC")
            implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.1")
            implementation("com.soywiz.korlibs.klock:klock:2.2.2")
            implementation("com.ionspin.kotlin:bignum:0.3.2")
        }
    }
    val commonTest by getting {
        dependencies {
            implementation(kotlin("test-common"))
            implementation(kotlin("test-annotations-common"))
        }
    }
    val androidMain by getting
    val androidTest by getting {
        dependencies {
            implementation(kotlin("test-junit"))
            implementation("junit:junit:4.13.2")
        }
    }

    val iosX64Main by getting
    val iosArm64Main by getting
    val iosMain by getting {
        dependsOn(commonMain)
        iosX64Main.dependsOn(this)
        iosArm64Main.dependsOn(this)
    }
    val iosTest by getting
}

cocoapods {
    framework {
        summary = "Some description for a Kotlin/Native module"
        homepage = "Link to a Kotlin/Native module homepage"
        baseName = "sharedCode"
        isStatic = false
        export(project(":sharedCode"))
        transitiveExport = true
    }
    podfile = project.file("/Users/user/Developments/SampleApp/Podfile")
    ios.deploymentTarget = "14.0"
}
}

这是我的个人档案

代码语言:javascript
复制
platform :ios, '14.0'
use_frameworks!

target 'Sample App' do
pod 'sharedCode', :path => '/Users/User/Developments/KotlinMultiplatform/sharedCode'
end

每当我从Android运行gradle同步时,它都会抛出此错误

代码语言:javascript
复制
Executing of 'pod install' failed with code 1.
Error message:

Please, check that file "/Users/User/Developments/SampleApp/Podfile" contains following lines in header:
source 'https://cdn.cocoapods.org'

Please, check that each target depended on sharedCode contains following dependencies:

然后我尝试从我的终端运行pod install命令,它成功地安装了cocoapods。然而,在构建过程中,我遇到了另一个问题

代码语言:javascript
复制
* What went wrong:
Execution failed for task ':sharedCode:linkPodDebugFrameworkIosArm64'.

在podDebugFramework二进制文件中导出的依赖项未指定为对应源集的API依赖项:

代码语言:javascript
复制
Project :sharedCode

Please add them in the API-dependencies and rerun the build.

我在这里错过了什么?谢谢

EN

回答 1

Stack Overflow用户

发布于 2021-12-05 21:16:14

我也有过同样的问题。打开终端并运行vim .zshrc。添加LANG=en_US.UTF-8,然后保存它。这解决了我的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69402134

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档