KMBANG
KMBANG

Reputation: 21

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.enter image description here

Development Environment

Step

  1. Create framework project (km-ios-sdk)

  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

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

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

xcodebuild -create-xcframework \
-framework './archive/km-ios-sdk.framework-iphoneos.xcarchive/Products/Library/Frameworks/km_ios_sdk.framework' \
-framework './archive/km-ios-sdk.framework-iphonesimulator-arm64.xcarchive/Products/Library/Frameworks/km_ios_sdk.framework' \
-output './KmSDK.xcframework'
  1. Created Package.swift as below and uploaded it to git. enter image description here

  2. If you download and import km-ios-sdk as spm in the sample app, the error appears enter image description here

It is the same even if you manually download .xcframework, and it is the same even if you download it with cocoapod. Is there any way to solve it?

Upvotes: 2

Views: 2366

Answers (1)

Daniel Zhang
Daniel Zhang

Reputation: 5858

We probably don't have the same dependency management configuration, but the following suggestions might help with the mysterious "Missing Required Module 'RxCocoaRuntime'" error that appears under some conditions.

  • Try removing any missing libraries or frameworks shown in red in Xcode. They can happen when using static libraries in CocoaPods. For Swift, we should add "use_frameworks!"
  • Check that all installed frameworks listed in the General tab exist by locating them in Finder.
  • Try building the target for "Any iOS Device" if they do not exist.
  • Finally, have a single source for RxSwift: SPM, Pods, or XCFrameworks. For example, RxDataSources, via SPM, incorporates RxSwift and RxCocoa. Therefore, a single package can cover multiple dependencies.

Upvotes: 0

Related Questions