We now have been noticing since launch iOS 17, that our code which renders PDFPage
objects to photographs was randomly failing (whereas no error is logged) and produced full black pictures. This drawback appears to solely happen on previous gadgets (iPad Professional 2017 and 2018) however not on current ones.
I point out that this portion code has been operating for a number of years in our app with none challenge from iOS10 to iOS16.
let renderFormat = UIGraphicsImageRendererFormat.default()
renderFormat.opaque = true
renderFormat.scale = CGFloat(scale)
let renderer = UIGraphicsImageRenderer(measurement: pageRect.measurement, format: renderFormat)
let mainImage = renderer.picture { 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 web page
context.saveGState()
UIColor.white.setFill()
context.clip(to: rect)
context.fill(rect)
web page.draw(with: .cropBox, to: context)
context.restoreGState()
}
Did anybody encountered an analogous challenge?
Is there any imply to get an error a minimum of in such instances ?
Thanks for any assist or recommendation on this challenge.