Cannot display bitmap images on iOS 15.7 and iPad 15.7

UIImage seems to be nil when trying to display bitmap images on iOS 15.7 and iPadOS 15.7.

This issue does not occur iOS 16 and iPadOS 16 beta.

note: some bitmap images can be displayed.

Here is the steps for reproduction.

  1. Download any image http://ww3.tiki.ne.jp/~k_nakada/material.html
  2. Add the image to Assets Catalog.
  3. Initialize UIImage and set it to UIImageView as following.
  4. The image cannot be displayed.
let imageView = UIImageView()
if let sampleData = NSDataAsset(name: "imageName")?.data {
    imageView.image = UIImage(data: sampleData)
}

I would appreciate any help, thanks.

Post not yet marked as solved Up vote post of SummerLight Down vote post of SummerLight
2.1k views
  • Did you submit a code-level request with Apple. I am having the same issue. It is clearly an IOS 15.7 issue as apps work under 15.6.1 and 16. As this is a terminal IOS version for many devices, Apple should address this immediately. I submitted a code-level request with Apple and have not heard back though they say they will respond in a couple of days. Just wondering if you did same. Has Apple acknowledged this with anyone?

Add a Comment

Replies

In general if something fails on an older OS but works on a newer one we'd consider it "bug resolved" – its unlikely a fix will happen for an older OS.

It would be useful to narrow down the failure a bit though. I would verify the following

  1. These images open in Preview on macOS 12 (which uses a similar set of image loading libraries as iOS 15)
  2. Ensure that the data you load from the NSDataAsset is identical to the data you downloaded
  3. Ensure that your example code produces valid sampleData

We have to resolve this issue because some devices can not upgrade to iOS16.

I can open Preview on macOS12.5.1.

The data load from NSDataAsset is identical to the downloaded data, and sampleData is not nil.

Agree totally about fixing this issue, it affects all web browsers on IOS 15.7 This 'worked' on IOS 15.6.1 so saying 16 fixed a bug is not correct, 15.7 broke BMP images in browsers.

Just click the link from above: http://ww3.tiki.ne.jp/~k_nakada/material.html

You will see the thumbnails, which are GIF's but clicking a thumbnail links to a BMP so all you get is a white screen with a small black box at the top of it.

I have devices, that for many technical reasons, stream multi-part BMP's and they are all blank screens now. The devices all do still BMP's, all blank now as in the example from above.

Essentially same issue.

My code is

UIImage *image = [[UIImage alloc] initWithContentsOfFile: filename]

filename is the path and name of the bitmap.

When executed, image comes back as nil (under 15.7)

The code runs without error on 15.6.1 and on IOS 16 but not under 15.7

I have a ton of users using iPad Mini 4 that can not update to 16 and there is no path back to IOS 15.6.1

The issue according to Apple is that there is a bug in IOS 15.7. The UIImage can not load bitmaps with depths/precision less than 24bits per pixel. They recommend using PNG files instead.

It was not clear when they plan on fixing this if ever.

I changed all my bitmaps to PNGs and the app worked flawlessly.

This issue also applies to Safari (and basically any other iOS browser). When loading a Bitmap as a Blob/b64 string into an <img> element it does not display anything. Changing the color depth to 24 bit 'fixes' it.