Post

Replies

Boosts

Views

Activity

Reply to Trying to print NSAttributedString via many UITextViews causes crash
Ignore my previous post. Mine was caused by a work around to a crash bug that appears to have since been fixed, such that now the work around causes a similar crash. I wonder if perhaps your issue may have been caused by the same bug, and has since disappeared in more recent versions of the OS? The work around was this: ` override func drawPrintFormatter(_ printFormatter: UIPrintFormatter, forPageAt pageIndex: Int) { //  WORK AROUND A CRASH BUG WHEN THERE ARE MULTIPLE UIPrintFormatters and pages //  See:  https://forums.developer.apple.com/thread/30009 var index = pageIndex if let printFormatter = printFormatter as? UIViewPrintFormatter { index = pageIndex - printFormatter.startPage; } return super.drawPrintFormatter(printFormatter, forPageAt:index); } `
Jul ’22
Reply to Trying to print NSAttributedString via many UITextViews causes crash
Did you ever resolve this? I'm having exactly the same problem, except that the index is different in my error: index 18446744073709551615 beyond bounds [0 .. 0] (Which I believe is -1 equivalent in an unsigned integer form.) My stack trace is identical to yours as far as I can tell. It actually displays the preview in the print panel, and then crashes. If I only attempt to print a single item it succeeds, but crashes when I try to print more than one item. However, if I print multiple items all on the one page (startingAtPage: 0 for all of them), it prints successfully and does NOT crash (but then of course all the items are printed overlapping on top of each other on a single page and looks terrible).
Jul ’22