Post

Replies

Boosts

Views

Activity

UIPrintInteractionController's printToPrinter crash in 'lookupLastUsedPrinter' API call.
Hi, We are seeing following crash in our codebase (iOS 15) with following call stack in UIPrintInteractionController. Could anyone please help with your inputs on how we can address following "UIPrintInteractionController's printToPrinter api crash" Crash stack uncaught ObjC exception, reason: -[PKPrinter _internalPrinter]: unrecognized selector sent to instance Last Exception Backtrace: 2 libobjc.A.dylib objc_exception_throw (??:0)w + 3 CoreFoundation __CFOAInitializeNSObject (??:0)3 + 4 CoreFoundation ___forwarding___ (??:0)3 + 5 CoreFoundation __CFRunLoopDoTimers (??:0)0 + 6 UIKitCore __51-[UIPrintPanelViewController lookupLastUsedPrinter]_block_invoke (??:0)5 + 7 UIKitCore -[UIPrintPanelViewController loadView] (??:0)5 + 8 UIKitCore __88-[UIPrintInteractionController _generatePDFInRange:useFullRange:withQuality:completion:]_block_invoke (??:0)5 + 9 UIKitCore -[UIPrintInteractionController printToPrinter:completionHandler:] (??:0)5 + 10 UIKitCore -[UIPrintInteractionController _completePrintPageWithError:] (??:0)5 + 11 UIKitCore -[UIPrintInteractionController printToPrinter:completionHandler:] (??:0)5 + Codebase that resulted above crash UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController]; UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printControllerT, BOOL completed, NSError *error) { [printControllerT setDelegate:nil]; }; [printController setDelegate:printDelegate]; [printController setPrintingItem:rurlPrintJob]; [printController presentAnimated:YES completionHandler:completionHandler]; More info meanwhile I have found one apple thread where its mentioned that “App Crash when using print of UIPrintInteractionController” ==>https://developer.apple.com/forums/thread/689876. Above thread suggested to use printer.contactPrinter instead of printerController.print.Since our current codebase used default iOS codepath(printToPrinter) with ‘[[UIPrintInteractionController sharedPrintController]presentAnimated:YES completionHandler:completionHandler]]’ api call , I am not able to apply this suggestion in current codebase.
1
1
1.5k
Jul ’22