The same thing happened to me too.
Is Apple acknowledging this to be a bug?
Are there any plans to fix it? Is there a thread that mentions this issue more specifically?
Post
Replies
Boosts
Views
Activity
I found out the cause and solved it.
The problem is that when the print window is displayed, the result rendered by the UIPrintPageRenderer is previewed in real time. At this point, something crashes as rendering and previewing happen simultaneously. This is considered an API bug.
The way to avoid it is not to render in real time in the print window, but to open the print window after setting the pre-rendered PDF file to printingItem before opening the print window.
I didn't get any app crashes when I did this.
UIPrintInteractionController *controller = (UIPrintInteractionController*)m_pController;
CGSize pageSize = CGSizeMake(595.2, 841.8); // default A4
UIEdgeInsets pageMargins = UIEdgeInsetsMake(72, 72, 72,72);
CGRect printableRect = CGRectMake(pageMargins.left, pageMargins.top,
pageSize.width - pageMargins.left - pageMargins.right,
pageSize.height - pageMargins.top - pageMargins.bottom);
CGRect paperRect = CGRectMake(0, 0, pageSize.width, pageSize.height);
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData( pdfData, paperRect, nil );
[self prepareForDrawingPages: NSMakeRange(0, self.numberOfPages)];
CGRect bounds = UIGraphicsGetPDFContextBounds();
for ( int i = 0 ; i < [self numberOfPages] ; i++ ) {
UIGraphicsBeginPDFPage();
[self drawPageAtIndex: i inRect: bounds];
}
UIGraphicsEndPDFContext();
controller.printingItem = pdfdata;
I am also experiencing this phenomenon.
I am using "-fshort-wchar" in the "Other C++ flags" option, but a build error occurs starting with xcode 15. Are there any changes in the compiler for wchar_t?
It looks like the xcode needs to be fixed or a guide on how to solve it.
Quick action is needed.
If anyone knows a solution, I would appreciate it if you could let me know.
Quick action is needed. Apple...