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
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.
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
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.
I solved this problem via:
- Run iOS Simulator
- Reset content and settings via "iOS Simulator > Reset Content and Settings" menu.
- It works.
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).