Display a PDF does not work correctly in iOS 15 using CoreGraphics libraries

I have an application coded in objective-c that are using CoreGraphics and CGPDFDocument, it's a PDF reader.

With the release of iOS 15 i'm having problems with the rendering of certain pages in certain PDF files. The problem is not present with PDFKit.

I have also downloaded the ZoomingPDFViewer example (https://developer.apple.com/library/archive/samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281) from the official apple documentation page and i see that the same thing happens.

See the problem

Replies

I can confirm that this problem occurs since iOS 15. As far as I am concerned, I think it is due to a mismapping of the color space, in particular the alpha channel, when rendering the image to the PDF drawing context.

However, I have found a small workaround for the time being. That is setting the bitmap drawing context to non-opaque.

UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);

Regarding the CATiledLayer, one can simply set the opaque flag to false.

CATiledLayer *tiledLayer = (CATiledLayer *)[self layer];
tiledLayer.opaque = NO;