purchases-ios
purchases-ios copied to clipboard
RevenueCat.xcframework.zip not compatible with use in SPM binaryTarget()
- [x] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
Describe the bug
The RevenueCat.xcframework.zip
that is produced for each release is not compatible for use as a binary target in swift package manager. Using a pre-compiled xcframework can substantially cut down on build times for both development and CI environments and increase overall productivity. For example one could define a Package.swift
using a binary target and provide the correct checksum for that release:
let package = Package(
/// ....
targets: [
/// ...
.binaryTarget(name: "RevenueCat",
url: "https://github.com/RevenueCat/purchases-ios/releases/download/4.15.4/RevenueCat.xcframework.zip",
checksum: "<the correct checksum>),
],
/// ...
)
SPM requires that the zip file contain only the framework and that the framework is available at the root level of the zip file per Apple's documentation. The current xcframework zip file contains a directory at the root named "xcframeworks" and then multiple sub-directories including the RevenueCat.xcframework
below it as follows:
- (root)
- xcframeworks
- archives
- RevenueCat.dSYMs
- RevenueCat.xcframework
- xcframeworks
The directory structure, and the archives
and RevenueCat.dSYMs
seem to be artifacts of how the xcframework was built using fastlane
and are certainly not needed in the final zip. #1118 already included the dSYMs info directly in the xcframework.
The fix is fairly straightforward which is to only include RevenueCat.xcframework
directory in the final zip file so the structure would be as follows:
- (root)
- RevenueCat.xcframework
This would then be compatible with both SPM and Carthage. Note that I have not tested this with Carthage, but there are other projects that provide Carthage xcframework.zip files that are structured in this manner and compatible with SPM.
I already have a PR to fix the issue that I will submit shortly.
- Environment
- Platform: iOS 16.x
- SDK version: 4.15.4
- StoreKit 2 (disabled with
useStoreKit2IfEnabled(false)
) (Y/N): N/A - OS version: MacOS 13.1 (build environment)
- Xcode version: 14.2
- How widespread is the issue. Percentage of devices affected.
- Debug logs that reproduce the issue
- Steps to reproduce, with a description of expected vs. actual behavior
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)