ReactiveX / RxSwift

Reactive Programming in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error Missing required module 'RxCocoaRuntime'

bangkm opened this issue · comments

commented

⚠️ If you don't have something to report in the following format, it will probably be easier and faster to ask in the slack channel first. ⚠️

⚠️ Please take you time to fill in the fields below. If we aren't provided with this basic information about your issue we probably won't be able to help you and there won't be much we can do except to close the issue :( ⚠️

If you still want to report issue, please delete above statements before submitting an issue.

Short description of the issue: Error Missing required module 'RxCocoaRuntime'

I am using RxCocoa in custom framework, so I am trying to inject dependencies with SPM and make that .xcframework. I made the .xcframework, but the following error keeps appearing.

The process of creating and configuring the framework project and creating the xcframework was as follows.

Development Environment

  • CPU : Apple slicon (M1 PRO)
  • MacOS : Ventura 13.1
  • Xcode : 14.1

Step

  1. Create framework project (sdk-sample)
  2. Set Build Active Architecture Only YES from NO
  3. Mach-O Type is Dynamic Library
  4. Write simple code using RxSwift, Rxcocoa
  5. Create .xcarchive and .xcframework
  6. Created Package.swift as below and uploaded it to git

Expected outcome:

Download the SDK I created in other apps and use it normally

What actually happens:

Error occur, Missing required module 'RxCocoaRuntime'

Self contained code example that reproduces the issue:

Make xcarchive and xcframework

xcodebuild archive \
-scheme sdk-sample \
-archivePath ./archive/sdk-sample.framework-iphoneos.xcarchive \
-sdk iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \

xcodebuild archive \
-scheme sdk-sample \
-archivePath ./archive/sdk-sample.framework-iphonesimulator-arm64.xcarchive \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \

xcodebuild -create-xcframework \
-framework './archive/sdk-sample.framework-iphoneos.xcarchive/Products/Library/Frameworks/sdk_sample.framework' \
-framework './archive/sdk-sample.framework-iphonesimulator arm64.xcarchive/Products/Library/Frameworks/sdk_sample.framework' \
-output './MySDK.xcframework'

Package.swift

let package = Package(
    name: "MySDK",
    platforms: [
        .iOS(.v13)
    ],
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "MySDK",
            targets: ["sdk-sample-target"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(
            url: "https://github.com/ReactiveX/RxSwift.git",
            .upToNextMajor(from: "6.5.0")
        )
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
//        .bin
        .binaryTarget(name: "MySDK", path: "MySDK.xcframework"),
        .target(
            name: "sdk-sample-target",
            dependencies: [
                .target(name: "MySDK"),
                .product(name: "RxSwift", package: "RxSwift"),
                .product(name: "RxCocoa", package: "RxSwift"),
            ],
            path: "Sources"
        ),
    ],
    swiftLanguageVersions: [
        .v5
    ]
)

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

6.5.0

Platform/Environment

  • [ o ] iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • [ o ] easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

14.3.1

⚠️ Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. ⚠️

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules
  • [ o ] SPM

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • [ o ] no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • [ 0 ] I have a small code base
  • I have a significant code base

Hey @bangkm,
We don't support specific build configuration / etc on this GitHub, only code-related bugs, etc.
I suggest checking out our Slack:
https://join.slack.com/t/rxswift/shared_invite/zt-1uw2ked5y-~76l4~stBMpLbExNQNnZ4Q

commented

@freak4pc
Thank you for your kindness. i will contact you through the slack you shared