0

I’m developing an iOS SDK and I want to distribute it as an XCFramework.

My requirements:

  • The SDK code must be hidden (binary-only).
  • Some dependencies (e.g., OpenSSL) are manually added as frameworks to the target, embedded & signed.
  • Some libraries are added via SPM.

In all 3rd party imports inside my SDK, I use:

@_implementationOnly import SomePackage

to avoid exposing them in the public interface.

I am trying to archive the SDK using xcodebuild archive to produce an XCFramework. Example commands:

xcodebuild archive \
-scheme DemoSDK \
OTHER_SWIFT_FLAGS="-no-verify-emitted-module-interface" \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath './build/DemoSDK.framework-iphoneos.xcarchive' \
-UseModernBuildSystem=YES \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES,

Problem

After adding the LiveKit SPM package, the archive fails with:

** ARCHIVE FAILED **
The following build commands failed:
 SwiftEmitModule normal arm64 Emitting module for LiveKit (in target 'LiveKit' from project 'LiveKit')
 EmitSwiftModule normal arm64 (in target 'LiveKit' from project 'LiveKit')
Archiving project DemoSDK with scheme DemoSDK

Things I have tried:

  • Cleaning DerivedData
  • Checking Debug/Release build settings
  • Using BUILD_LIBRARY_FOR_DISTRIBUTION=YES
  • Switching Swift version between 5 and 6

Yet the archive still fails at Swift module emit. What is the proper way to include SPM packages like LiveKit into an XCFramework without causing archive failures?

asked Sep 17, 2025 at 21:58

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.