Context
We made a simple swift package containing resources (images only).
The structure is as follows:
(App) -> (Swift Package A) -> (ImageProvider - package that contains images)
Everything runs fine during development, and even archiving and exporting the app via Xcode works. The .ipa contains all the bundles and they contain Assets.car
, and everything just works.
Problem
The issue comes up when the app is archived on our CI/CD pipeline, via xcodebuild
.
The code is simple, we have:
// Inside our package with images
open class ImageProvider {
private static func getImage(named: String) -> Image {
let uiImage = UIImage(named: named) ?? UIImage(named: named, in: .module, compatibleWith: nil)!
return Image(uiImage: uiImage)
}
open class var logo: Image { getImage(named: "logo") }
// etc..
Here are the commands we issue when archiving our app:
xcodebuild -sdk iphoneos -configuration release -project ./Apps/TheApp/TheApp.xcodeproj -scheme TheApp clean archive -archivePath ./TheApp.xcarchive PRODUCT_BUNDLE_IDENTIFIER=com.the.app MARKETING_VERSION=1.0 CURRENT_PROJECT_VERSION=1234 CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
xcodebuild -exportArchive -archivePath ./TheApp.xcarchive -exportPath ./ -exportOptionsPlist ./exportOptions.plist -allowProvisioningUpdates
When I try to run the .ipa file on a device I get the following errors:
Could not load asset catalog from bundle NSBundle </private/var/containers/Bundle/Application/F8CABB60-16FD-4096-88D5-8ECD8E73AD6E/TheApp.app> (loaded): Error Domain=NSCocoaErrorDomain Code=260 "RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: com.the.app" UserInfo={NSLocalizedDescription=RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: com.the.app}
Could not load asset catalog from bundle NSBundle </var/containers/Bundle/Application/F8CABB60-16FD-4096-88D5-8ECD8E73AD6E/TheApp.app/ImageProvider_ImageProvider.bundle> (not yet loaded): Error Domain=NSCocoaErrorDomain Code=260 "RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: com.the.app" UserInfo={NSLocalizedDescription=RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: com.the.app}
But the Assets.car
is there:
Questions
- Is everything fine with the structure/code or am I doing something wrong?
- Is this a bug or am I missing a step when archiving my library?
Thanks!