Post

Replies

Boosts

Views

Activity

App Crash when using print of UIPrintInteractionController
Using the latest Xcode 13 Beta 5 and try to print a PDF document on a predefined printer the App Crashes. I created a new iOS App running it on Simulator iPhone 12/iOS 15 with the following code: let a4Document = Bundle.main.url(forResource: "A4", withExtension: "pdf")! let airPrinter = UIPrinter(url: URL(string: "ipps://oki-c332.local.:443/ipp/print")!) struct ContentView: View {     var body: some View {         Button("Print") {             DispatchQueue.main.async {                 let printController = UIPrintInteractionController.shared                 let printInfo = UIPrintInfo(dictionary:nil)                 printInfo.jobName = "AirPrint"                 printInfo.outputType = UIPrintInfo.OutputType.grayscale                 printController.printInfo = printInfo                 printController.printingItem = a4Document                 printController.print(to: airPrinter)             }         }     } } It failed when trying to print with: 2021-09-13 10:59:01.880869+0200 AirPrintTest[40566:741434] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally a view controller <UIAlertController: 0x7fb79a035c00> that is already being presented by <UIViewController: 0x7fb7987229c0>.' 2*** First throw call stack: 3( 4 0 CoreFoundation 0x00007fff203fc8a8 __exceptionPreprocess + 242 5 1 libobjc.A.dylib 0x00007fff2019ebe7 objc_exception_throw + 48 6 2 UIKitCore 0x00007fff2484b382 -[UIViewController _presentViewController:withAnimationController:completion:] + 5854 7 3 UIKitCore 0x00007fff2484bf6c __63-[UIViewController _presentViewController:animated:completion:]_block_invoke_2 + 70 8 4 UIKitCore 0x00007fff2559baa5 +[UIView(Animation) performWithoutAnimation:] + 84 9 5 UIKitCore 0x00007fff2484bec1 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 211 10 6 UIKitCore 0x00007fff2484c186 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 519 11 7 UIKitCore 0x00007fff2484bdae -[UIViewController _presentViewController:animated:completion:] + 173 12 8 UIKitCore 0x00007fff2484c23c -[UIViewController presentViewController:animated:completion:] + 155 13 9 UIKitCore 0x00007fff24faee9e -[UIPrintingProgress _mainQueue_presentProgressAlert] + 395 14 10 UIKitCore 0x00007fff24faf2fe -[UIPrintingProgress _mainQueue_showProgress:immediately:] + 844 15 11 UIKitCore 0x00007fff24faef03 -[UIPrintingProgress showProgress:immediately:] + 66 16 12 UIKitCore 0x00007fff24faf8ae -[UIPrintingProgress setPrintInfoState:] + 119 17 13 UIKitCore 0x00007fff24fbf50c -[UIPrintInteractionController _setPrintInfoState:] + 80 18 14 UIKitCore 0x00007fff24fb8d36 __65-[UIPrintInteractionController printToPrinter:completionHandler:]_block_invoke.151 + 236 19 15 libdispatch.dylib 0x0000000100ef3a18 _dispatch_call_block_and_release + 12 20 16 libdispatch.dylib 0x0000000100ef4bfc _dispatch_client_callout + 8 21 17 libdispatch.dylib 0x0000000100f03366 _dispatch_main_queue_callback_4CF + 1195 22 18 CoreFoundation 0x00007fff2036a555 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 23 19 CoreFoundation 0x00007fff20364db2 __CFRunLoopRun + 2772 24 20 CoreFoundation 0x00007fff20363dfb CFRunLoopRunSpecific + 567 25 21 GraphicsServices 0x00007fff2cbb5cd3 GSEventRunModal + 139 26 22 UIKitCore 0x00007fff24fee193 -[UIApplication _run] + 928 27 23 UIKitCore 0x00007fff24ff2bfb UIApplicationMain + 101 28 24 SwiftUI 0x00007fff5cc8f6d5 $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 196 29 25 SwiftUI 0x00007fff5cc8f60f $s7SwiftUI6runAppys5NeverOxAA0D0RzlF + 148 30 26 SwiftUI 0x00007fff5c685e55 $s7SwiftUI3AppPAAE4mainyyFZ + 61 31 27 AirPrintTest 0x0000000100dcf99e $s12AirPrintTest0abC3AppV5$mainyyFZ + 30 32 28 AirPrintTest 0x0000000100dcfa19 main + 9 33 29 dyld 0x0000000100fe4e1e start_sim + 10 34 30 ??? 0x00000001062794d5 0x0 + 4398224597 35) 36libc++abi: terminating with uncaught exception of type NSException Is this bug known?
15
0
6.1k
Sep ’21