kean/Nuke

Nuke caching issue: Is this caused by this Apple ImageIO error?

drmarkpowell opened this issue · 5 comments

I am seeing a consistent decoding error on the debug console with a particular image (tv poster from URL). iOS 17.0.3, Xcode 15.0.1, macOS Sonoma. Is this an Apple ImageIO bug, or something that you'd want to look at in Nuke? If it's an Apple bug, I'll just file it as a feedback.

Thanks!
Error:

callDecodeImage:2005: *** ERROR: decodeImageImp failed - NULL _blockArray

Reproducible example:

import SwiftUI
import NukeUI

struct ContentView: View {
    let path = "https://static.tvmaze.com/uploads/images/original_untouched/473/1184947.jpg"
    var body: some View {
        VStack {
            LazyImage(url: URL(string: path)!) { state in
                if let image = state.image {
                    image.resizable()
                } else {
                    Text("Loading...")
                }
            }
            Text("Hello, world!")
        }
        .padding()
    }
}

#Preview {
    ContentView()
}

Just answered my own question in part or in full...I tried the same image with AsyncImage in SwiftUI and I got the same error (no Nuke in the mix), so it's def an Apple bug.

Whatever the error is, it behaves as if it's interfering with Nuke's caching of the image. Every time I make the view, it reloads the original image from the network instead of pulling from cache, which leads me to believe/imagine that it prevents Nuke from caching the image in the first place.

I just tried it with iOS 17.1 RC and it has not been fixed. Filed feedback FB13293667.

kean commented

The likely reason for failing decoding/bitmapping is the size of the image: 7213× 10236 px. I would recommend downscaling it.

Thanks for the insight! I will take that advice :)