Xcode 14 beta 3: Widget archival failed due to image being too large

I'm setting the .background() of my Widget with an Image, and getting this error in Xcode 14 beta 3 :

WidgetExtension[] [archiving] Widget archival failed due to image being too large [4] - (1920, 1080).

Is this a bug in Xcode, or a new intended failure I can't find documentation for yet?

I've never gotten this with previous versions of Xcode 13 for this Widget, but the error is telling me there is some sort of size constraint now potentially.

Add a Comment

Replies

I experienced the same issue, and unfortunately, I haven't found a bypass; however, this issue is relatively easy to address by simply down-sizing the images you display on your widgets.

I use a function (attached below) to resize widget images to a width of 800 which I found to be a sweet spot.

extension UIImage {
  func resized(toWidth width: CGFloat, isOpaque: Bool = true) -> UIImage? {
    let canvas = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height)))
    let format = imageRendererFormat
    format.opaque = isOpaque
    return UIGraphicsImageRenderer(size: canvas, format: format).image {
      _ in draw(in: CGRect(origin: .zero, size: canvas))
    }
  }
}
  • resizing image to smaller size is the solutions for iOS 16 widgetkit

  • This fixed my widgets. The same app when run from Xcode 14 stopped working because of this error "Widget archival failed due to image being too large"

  • Thank you so much for sharing this. I opened a TSI and was told to open feedback for a bug. This fixed my widget that was working fine when I last built it for iOS 15.

If you're using vector files (PDF, SVG), you don't need to resize your images.

Head to the image's attributes inspector and check "Preserve vector data" in front of Resizing.

  • This worked for me as I was using SVGs. Thanks!

  • Thanks a bunch. In my case, I opened a PNG asset in Preview, exported it as PDF and then did as suggested above in the Attributes inspector and this indeed fixed the issue. Whoo hoo!

  • This fixed it for me! Thank you!

Add a Comment