We have been noticing since release iOS 17, that our code which renders PDFPage objects to images was randomly failing (while no error is logged) and produced full black images. This problem seems to only occur on old devices (iPad Pro 2017 and 2018) but not on recent ones.
I mention that this portion code has been running for several years in our app without any issue from iOS10 to iOS16.
let renderFormat = UIGraphicsImageRendererFormat.default()
renderFormat.opaque = true
renderFormat.scale = CGFloat(scale)
let renderer = UIGraphicsImageRenderer(size: pageRect.size, format: renderFormat)
let mainImage = renderer.image { context in
// Setup drawing context
context.cgContext.setShouldAntialias(false)
context.cgContext.setShouldSmoothFonts(false)
context.cgContext.setAllowsFontSmoothing(false)
context.cgContext.setShouldSubpixelPositionFonts(true)
context.cgContext.setShouldSubpixelQuantizeFonts(true)
// Draw pdf page
context.saveGState()
UIColor.white.setFill()
context.clip(to: rect)
context.fill(rect)
page.draw(with: .cropBox, to: context)
context.restoreGState()
}
Did anyone encountered a similar issue?
Is there any mean to get an error at least in such cases ?
Thanks for any help or advice on this issue.