24

When loading UIImages with png images in Xcode 6 beta 3 in Swift as follows:

    PipsImg = (UIImage(named: "Die-1"))

or

    PipsImg = [(UIImage(named: "Die-1")),(UIImage(named: "Die-2"))]

from associated images stored in the Images.xcassets folder, I receive the following fatal runtime errors:

 SimpleAnimation[680:60b] Unsupported pixel format in CSI
 SimpleAnimation[680:60b] Unable to create unsliced image from csi bitmap data.

this appears to be resolved in beta 4, however will leave in place for a bit as sometimes these regress

dave_the_dev
  • 1,555
  • 3
  • 15
  • 27

5 Answers5

35

This is caused by a bug in Xcode 6 (beta 3 at this time). It appears to occur only if your build target is iOS 7.x

To work around this issue:

1) delete the files from the Images.xcassets container.

2) place the images directly into the "Supporting Files" folder.

Note: It is not required to add the ".png" extension within your code, making this a clean workaround.

Please create a RADAR (bug report) to Apple.

dave_the_dev
  • 1,555
  • 3
  • 15
  • 27
23

XCode 6.0.1 still have this problem. If you add .jpg to Images.xcassets and try to install app to the iOS 7 device.

To fix it just convert .jpg to .png

PowHu
  • 2,159
  • 16
  • 17
  • XCode 6.1 also has it but when I converted jpg to png there was no problem. Always using png on xcassets and I accidentally included 2 jpg files and had this issue. It definitely is an issue of xcassets with jpg files. – Pericles Oct 21 '14 at 13:30
17

Apple engineer's response:

The issue is that iOS 7 apps cannot have JPEG images in the CAR file. actool should have copied the JPEG as a loose image into your app's folder. To work around this issue, you should either convert the image to a PNG or include the JPEG as a resource outside of the asset catalog.

King-Wizard
  • 15,628
  • 6
  • 82
  • 76
0

I solved this problem via:

  1. Run iOS Simulator
  2. Reset content and settings via "iOS Simulator > Reset Content and Settings" menu.
  3. It works.
ccoroom
  • 699
  • 9
  • 23
0

In Xcode we now have a possibility to do a slicing for the image resources. If slicing is added the corresponding json for an image in asset catalog gets resizing info. This may look for example like this

"resizing" : {
    "mode" : "3-part-vertical",
    "center" : {
      "mode" : "fill",
      "height" : 6
    },
    "capInsets" : {
      "top" : 16,
      "bottom" : 6
    }
  }

iOS 7.0 doesn't handle slicing properly. So removing the slicing info from json may help to fix the problem (in my case that was a solution).

Sergey
  • 11