ge-org / multiplatform-swiftpackage

Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.
Apache License 2.0
333 stars 49 forks source link

While building for Mac Catalyst, no library for this platform was found #33

Open iulian-buzila opened 3 years ago

iulian-buzila commented 3 years ago

Hi, I'm using this framework to generate xcframework for ios/macos. Work on ios, but for mac I receive an error in Xcode:

While building for Mac Catalyst, no library for this platform was found in '.../shared/swiftpackage/KMMProject.xcframework'.

Configuration:

multiplatformSwiftPackage {
    packageName("KMMProject")
    swiftToolsVersion("5.3")
    targetPlatforms {
        iOS { v("13") }
        targets("macosX64") { v("10.0") }
    }
}
val packForXcode by tasks.creating(Sync::class) {
    group = "build"
    val targetDir = File(buildDir, "xcode-frameworks")
    val mode = System.getenv("CONFIGURATION") ?: "DEBUG"

    val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
    val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
    val frameworkIos = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)

    inputs.property("mode", mode)
    dependsOn(frameworkIos.linkTask)
    from({ frameworkIos.outputDirectory })
    into(targetDir)

    val frameworkMac = kotlin.targets.getByName<KotlinNativeTarget>("macOS").binaries.getFramework(mode)
    inputs.property("mode", mode)
    dependsOn(frameworkMac.linkTask)
    from({ frameworkMac.outputDirectory })
    into(targetDir)
}

Is there any fix for that?

imfractured commented 2 years ago

bump! just wondering if there are any updates on this issue? I'm seeing the same results.

kyzmitch commented 2 years ago

I've faced the same issue, wanted to be able to run the unit tests in Xcode for this target.

Dlankheet commented 2 years ago

I've faced the same issue, wanted to be able to run the unit tests in Xcode for this target. @kyzmitch @imfractured

Did you find a fix for the problem? I tried to run archive with xcode and tried to run it in the CI pipeline but keep getting the same error.

kyzmitch commented 2 years ago

I've faced the same issue, wanted to be able to run the unit tests in Xcode for this target. @kyzmitch @imfractured

Did you find a fix for the problem? I tried to run archive with xcode and tried to run it in the CI pipeline but keep getting the same error.

I was able to upload the app to iTunesConnect using SwiftPackage produced by this tool or maybe XCFrameworks produced by it. For the unit tests I just used iOS simulator target for running and disabled Mac Catalyst completely for now.