Asset Catalog

RSS for tag

An asset catalog is a type of file used to organize and manage different assets and image resolutions used by your app’s user interface.

Asset Catalog Documentation

Posts under Asset Catalog tag

41 Posts
Sort by:
Post not yet marked as solved
9 Replies
2.7k Views
I just upgraded to XCode15.3 and now all my projects with Assets are getting this compile error. I have tried removing DerivedData caches and rebooting but still get this error. Anyone else hit this problem with XCode 15.3? I was only Building for IOS 16.4 and 17.0.1 and Xcode 14.0 and 15.0 Build Error: Command CompileAssetCatalog failed with a nonzero exit code *** Terminating app due to uncaught exception 'IBPlatformToolFailureException', reason: 'The tool closed the connection (AssetCatalogSimulatorAgent) Execution Context: <IBSimulatorToolCoreSimulatorCLIExecutionContext: 0x600003d5d260 busyCount=0, Idle for 0.0 secs, lifeTime=26.3 secs>, device=IBSimDeviceTypeiPad3x (865E7291-E467-4E8D-B535-D64F43A57F15, iOS 17.4, Shutdown), idiom=<IBIPhoneIdiom: 0x6000028b8000>
Posted
by
Post not yet marked as solved
2 Replies
478 Views
Currently, I try to test the ImageTrackingProvider with the Apple Vision Pro. I started with some basic code: import RealityKit import ARKit @MainActor class ARKitViewModel: ObservableObject{ private let session = ARKitSession() private let imageTracking = ImageTrackingProvider(referenceImages: ReferenceImage.loadReferenceImages(inGroupNamed: "AR")) func runSession() async { do{ try await session.run([imageTracking]) } catch{ print(error) } } func processUpdates() async { for await _ in imageTracking.anchorUpdates{ print("test") } } } I only have one picture in the AR folder. I added the size an I have no error messages in the AR folder. As I am trying to run the application with the vision Pro, I receive following error: ar_image_tracking_provider_t <0x28398f1e0>: Failed to load reference image <ARReferenceImage: 0x28368f120 name="IMG_1640" physicalSize=(1.350, 2.149)> with error: Failed to add reference image. It finds the image, but there seems to be a problem with the loading. I tried the jpeg and the png format. I do not understand why it fails to load the ReferenceImage. I use Xcode Version 15.3 beta 3
Posted
by
Post marked as solved
1 Replies
341 Views
For example I created a project aaa. aaa source folder is called aaa. that is aaa aaa/aaa then I put a data file in aaa/aaa/some.data now i want to test data in aaa/aaaTests/aaaTests.swift How can i access aaa/aaa/some.data in aaaTests.swift? If I want to access some.data inside aaa/aaa/ContentView.swift, how to write the code? I have been searching google and bing for days, but find no example answering my questions. Can anyone help me out? Thanks in advance.
Posted
by
Post not yet marked as solved
2 Replies
553 Views
I created a distinct icon set for visionOS, and specified its name in build settings. This is a Designed for iPad app. When I run it in the simulator, only the existing app icon shows. Is this supported for existing iPad apps, or am I missing something? There are no warnings in the asset catalog for this.
Posted
by
Post not yet marked as solved
3 Replies
565 Views
I have an AppleTV app which I released in 2016. I've updated it and released a new version every year without much hassle. This year, with tvOS 17.2, the layered app icon isn't working right. This is a two-layer image made with PNGs. When it's selected, it looks right and the layers move correctly: But when it's not selected, the background layer disappears: Screenshots are from the simulator but it also happens on the device. It's inconsistent; sometimes it's the front layer that disappears. Occasionally both layers work, but I can't tell why. I've spent a day trying everything. Very frustrated. The icon previews correctly in Xcode and in Parallax Viewer. The image sizes are correct: 400 x 240 for Small, 800 x 480 for Small@2x, 1280 x 768 for Large. The back layer is a non-transparent PNG. I tried adding a Large@2x set. Didn't help. Originally I had a three-layer image with no middle layer PNG. I deleted the empty middle layer, but that didn't help. All the PNG files are from GnuIMP. Same color space, even. I was using the filenames tvicon-back-s.png and tvicon-back-s@2x.png. I tried taking out the @ sign in case that was confusing Xcode. (It never has before, but I am flailing here.) Anybody have any clues? If it's an Apple bug and there's nothing I can do, I'm going to just push the release button and hope it fixes itself someday.
Posted
by
Post not yet marked as solved
0 Replies
316 Views
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-rule="evenodd" height="48" preserveAspectRatio="none" stroke-linecap="round" viewBox="0 0 2240 480" width="224"> <style type="text/css"> .brush0 { fill: rgb(255,255,255); } .pen0 { stroke: rgb(0,0,0); stroke-width: 1; stroke-linejoin: round; } .font0 { font-size: 303px; font-family: "Times New Roman", serif; } .font1 { font-style: italic; font-size: 303px; font-family: "Times New Roman", serif; } .font2 { font-size: 274px; font-family: Symbol, serif; } .font3 { font-weight: bold; font-size: 16px; font-family: System, sans-serif; } </style> <g> <text class="font0" fill="rgb(0,0,0)" stroke="none" style="dominant-baseline: alphabetic;" x="154 264 836 1473 1925" xml:lang="en" xml:space="preserve" y="320">(3)13</text> <text class="font1" fill="rgb(0,0,0)" stroke="none" style="dominant-baseline: alphabetic;" x="49 731 2077" xml:lang="en" xml:space="preserve" y="320">iii</text> <text class="font2" fill="rgb(0,0,0)" stroke="none" style="dominant-baseline: alphabetic;" x="484 1026 1290 1678" xml:space="preserve" y="320">+=-+</text> </g> </svg> Review the specific issue
Posted
by
Post not yet marked as solved
0 Replies
459 Views
We want to provide an alternate app icon in our bundle specifically for testing with an App Store test treatment (A/B test). What I'm unclear about is whether we then need to enable users to choose from the available app icons, since there are now multiple. I have seen reports of apps being rejected because they didn't offer this feature when multiple alternate icon sets were bundled. We do NOT want to allow users to select an app icon. Also, is it permissible to have a different icon for the App Store than what is used for the device app-launcher? I believe the guidance here is that all sizes of the icon should have the same content (just resized), but our marketing people want to test a different icon for the app-store specifically. Is there guidance on this somewhere that I haven't found?
Posted
by
Post not yet marked as solved
1 Replies
507 Views
Related APIs: +[UIImage imageNamed:] +[UIImage imageNamed:inBundle:compatibleWithTraitCollection:] When there is only a color set with the name (no image set provided), reading the image with the above-mentioned APIs throws an exception: 2023-12-19 19:30:34.008701+0800 ***[57410:578064] *** Assertion failure in -[_UIImageCGImageContent initWithCGImageSource:CGImage:scale:], _UIImageContent.m:666 2023-12-19 19:30:34.031207+0800 ***[57410:578064] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Need an imageRef' Even when wrapped in a try/catch block, it still crashes due to a lock issue after calling the related API twice. Here is an example code snippet: UIImage *image; for (NSInteger i=0; i<10; i++) { @try { image = [UIImage imageNamed:@"sample"]; //image = [UIImage imageNamed:@"sample" inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; } @catch (NSException *exception) { } } The crash backtrace is as follows: #0 0x0000000102b12214 in _os_unfair_lock_recursive_abort () #1 0x0000000102b0da50 in _os_unfair_lock_lock_slow () #2 0x000000010ab07624 in -[UIImageAsset imageWithConfiguration:] () #3 0x000000010b2f4634 in -[_UIAssetManager imageNamed:configuration:] () #4 0x000000010aaf2394 in +[UIImage imageNamed:inBundle:withConfiguration:] () #5 0x000000010aaf2200 in +[UIImage imageNamed:inBundle:compatibleWithTraitCollection:] () #6 0x0000000105442154 in +[UIImageAccessibility imageNamed:inBundle:compatibleWithTraitCollection:] () It seems that the color set is being treated as an imageRef in this image reading process. It's a bug of UIKit?
Posted
by
Post not yet marked as solved
0 Replies
389 Views
"I am developing a project called 'Avatar Creator.' In the HeadSelectionView, BodySelectionView, and LegSelectionView screens, the user will choose one of the images available there. In the final FinalSelectionView screen, I want to display the images the user selected, but I'm facing a problem. In the FinalSelectionView screen, only the last selected 'Leg' image is visible; the 'Head' and 'Body' images return 'nil' (null). I'm leaving the code I wrote below. Can you help?" import SwiftUI enum ImageHead: String, CaseIterable, Identifiable { case smile = "head-0" case smileWithEyebrow = "head-1" case happy = "head-2" case sad = "head-3" case verySad = "head-4" case shocked = "head-5" var id: ImageHead { self } } enum ImageBody: String, CaseIterable, Identifiable { case black = "body-0" case brown = "body-1" case red = "body-2" var id: ImageBody { self } } enum ImageLeg: String, CaseIterable, Identifiable { case blue = "leg-0" case grey = "leg-1" case black = "leg-2" var id: ImageLeg { self } } struct SelectionImageView: View { var image: String var body: some View { Image(image) .resizable() .aspectRatio(contentMode: .fit) .frame(width: 150, height: 150) } } struct ContentView: View { @State private var userSelectedHead: ImageHead? @State private var userSelectedBody: ImageBody? @State private var userSelectedLeg: ImageLeg? var body: some View { NavigationView { ScrollView(.horizontal) { LazyHGrid(rows: [GridItem(.flexible())]) { ForEach(ImageHead.allCases, id: \.self) { head in NavigationLink(destination: BodySelectionView(userSelectedHead: $userSelectedHead, userSelectedBody: $userSelectedBody, userSelectedLeg: $userSelectedLeg)) { VStack { SelectionImageView(image: head.rawValue) Text("Selected Head: \(userSelectedHead?.rawValue ?? "None")") } } .padding() } } } .navigationTitle("Select Head") } } } struct BodySelectionView: View { @Binding var userSelectedHead: ImageHead? @Binding var userSelectedBody: ImageBody? @Binding var userSelectedLeg: ImageLeg? var body: some View { ScrollView(.horizontal) { LazyHGrid(rows: [GridItem(.flexible())]) { ForEach(ImageBody.allCases, id: \.self) { body in NavigationLink(destination: LegSelectionView(userSelectedHead: $userSelectedHead, userSelectedBody: $userSelectedBody, userSelectedLeg: $userSelectedLeg)) { VStack { SelectionImageView(image: body.rawValue) Text("Selected Head: \(userSelectedHead?.rawValue ?? "None")") Text("Selected Body: \(userSelectedBody?.rawValue ?? "None")") } } .padding() } } } .navigationTitle("Select Body") } } struct LegSelectionView: View { @Binding var userSelectedHead: ImageHead? @Binding var userSelectedBody: ImageBody? @Binding var userSelectedLeg: ImageLeg? var body: some View { ScrollView(.horizontal) { LazyHGrid(rows: [GridItem(.flexible())]) { ForEach(ImageLeg.allCases, id: \.self) { leg in NavigationLink(destination: FinalSelectionView(userSelectedHead: $userSelectedHead, userSelectedBody: $userSelectedBody, userSelectedLeg: $userSelectedLeg, selectedLeg: leg)) { VStack { SelectionImageView(image: leg.rawValue) Text("Selected Head: \(userSelectedHead?.rawValue ?? "None")") Text("Selected Body: \(userSelectedBody?.rawValue ?? "None")") Text("Selected Leg: \(leg.rawValue)") } } .padding() } } } .navigationTitle("Select Leg") } } struct FinalSelectionView: View { @Binding var userSelectedHead: ImageHead? @Binding var userSelectedBody: ImageBody? @Binding var userSelectedLeg: ImageLeg? var selectedLeg: ImageLeg var body: some View { VStack { if let head = userSelectedHead { SelectionImageView(image: head.rawValue) Text("Selected Head: \(head.rawValue)") } else { Text("Default Head Image") } if let body = userSelectedBody { SelectionImageView(image: body.rawValue) Text("Selected Body: \(body.rawValue)") } else { Text("Default Body Image") } SelectionImageView(image: selectedLeg.rawValue) Text("Selected Leg: \(selectedLeg.rawValue)") Spacer() } .navigationTitle("Final Selection") .padding(.horizontal) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
Posted
by
Post marked as solved
4 Replies
580 Views
My In-App purchases are actually JSON files which provide metadata for my app. I am required to provide a "screenshot" for each of these IAPs before they can be accepted. What is the common practice for screenshots when it is just a JSON file of structured data to be used within the app. Surely someone else has run into this issue by now. What are we supposed to do?
Posted
by
Post not yet marked as solved
0 Replies
772 Views
It appears I can't add a WebP image as an Image Set in an Asset Catalog. Is that correct? As a workaround, I added the WebP image as a Data Set. I'm then loading it as a CGImage with the following code: guard let asset = NSDataAsset(name: imageName), let imageSource = CGImageSourceCreateWithData(asset.data as CFData, nil), let image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil) else { return nil } // Use image Is it fine to store and load WebP images in this way? If not, then what's best practice?
Posted
by
Post not yet marked as solved
0 Replies
643 Views
I want to access to a small number of Markdown text files. It looks like the asset catalog feature "Folder with Namespace" might do well, as I could store these small files in a folder that the asset catalog contains. How would I go about getting the string contents of a particular file if I know its name?
Posted
by
Post not yet marked as solved
0 Replies
556 Views
My app uses various PNG images for parts of its UI. In Sonoma these images are rendered all blurred. It looks like I'm putting a 10 or 20px gaussian blur on it, which of course I am not. In prior macOS versions they have rendered just fine. Occasionally some user action in the app will cause a part of one or two images to render sharply, but then it quickly reverts to the blur. I have added the PNGs to the app as image set assets, providing 1x and 2x versions for light and dark modes respectively (so four images each). I'm loading them using NSImage(named: ), and in most cases putting them into an NSImageView. I also use one of them as a patternImage: if let image = NSImage(named: "RackFrame") { let color = NSColor.init(patternImage: image) color.setFill() dirtyRect.fill() } Both methods result in the same issue. Any thoughts on what's going on would be gratefully received!
Posted
by
Post not yet marked as solved
0 Replies
691 Views
The Assets.car file in Archive and thus in exported .ipa file has significantly increased when archived in Xcode 15 compared to Xcode 14.3.1. For example, the Assets.car file size in the archive made in Xcode 14.3.1 is 125 MB, but in the archive made in Xcode 15 from completely the same project size is 200 MB. Assets have many images as PNG and PDF. What has changed in Xcode 15 for building Assets.car file and how the size can be reduced? Use SVG instead of PDF (and PNG?)? Thanks
Posted
by
Post marked as solved
1 Replies
841 Views
I recently was thinking about which is the best format to use for my little icons in the app, and was considering the performance of PNG versus SVG . I know that PNG decoders are hardware accelerated and parallelized, and the rendering is as simple as placing the pixels on the screen. On the other hand, SVG requires computation to determine the placement of pixels based on mathematical equations. Considering this, my current assumption is that PNG is faster to render than SVG. However, if SVG is also hardware-accelerated, it could alter the situation, although this may not be the case.
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
I am rendering a png image with an alpha channel from XCAssets in a UIImageView. The rendering occurs as it should in iOS 16 / Xcode 14, but the image is distorted in iOS 17 beta / Xcode 15 beta. I am not sure why, but the distortion is very apparent. I have attached below the original PNG, as well a screenshot comparing the incorrect iOS 17 / Xcode 15 beta behavior vs the iOS 16 / Xcode 14 desired behavior. Comparision: Original image:
Posted
by