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
- Create framework project (sdk-sample)
- Set Build Active Architecture Only YES from NO
- Mach-O Type is Dynamic Library
- Write simple code using RxSwift, Rxcocoa
- Create .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'
- Created Package.swift as below and uploaded it to git
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
]
)
When I download the SDK I made with spm, an error occurs Is there any way to solve it?
Did you ever find a solution to your issue ? I'm facing the same one, and don't know where this is coming from.