AirPrint

RSS for tag

AirPrint allows photo and document printing in your iOS apps and macOS apps without the need to download or install drivers.

Posts under AirPrint tag

76 Posts

Post

Replies

Boosts

Views

Activity

PrintKitUI random crash
Code to print self.airPrintWebView.loadHTMLString(html, baseURL: nil) self.view.add(subView:self.airPrintWebView) let formatter = self.airPrintWebView.viewPrintFormatter() //1.5" margins for the page formatter.perPageContentInsets = UIEdgeInsets(top: HALF_INCH_INSET, left: ONE_INCH_INSET, bottom: ONEHALF_INCH_INSET, right: ONE_INCH_INSET) let activityVC = UIActivityViewController(activityItems: [formatter], applicationActivities: nil) // Prevents iBook and PDF from being options activityVC.excludedActivityTypes = [.openInIBooks, .markupAsPDF] activityVC.completionWithItemsHandler = { (activity, success, items, error) in self.airPrintWebView.removeFromSuperview() if shouldRemoveSenderButton { sender.removeFromSuperview() } PredictSpringApplication.sharedInstance.psAlertBlockView?.isHidden = false } if PSUtil.isIpad() { activityVC.popoverPresentationController?.sourceView = self.airPrintWebView activityVC.popoverPresentationController?.sourceRect = sender.frame } self.present(activityVC, animated: true, completion: nil) Crash Crashed: com.apple.main-thread 0 CoreGraphics 0x107e6c CGPDFDocumentIsEncrypted + 12 1 PrintKitUI 0x586b0 -[UIPrintPreviewPageFetcher redrawQuicklookPDF:] + 104 2 PrintKitUI 0x28f4c -[UIPrintPreviewViewController updateQuicklookPDF] + 148 3 Foundation 0xa6f14 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 24 4 Foundation 0x7b020 -[NSBlockOperation main] + 104 5 Foundation 0x7afb0 NSOPERATION_IS_INVOKING_MAIN + 16 6 Foundation 0x3c4d8 -[NSOperation start] + 708 7 Foundation 0x3c20c NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 16 8 Foundation 0x4189c __NSOQSchedule_f + 172 9 libdispatch.dylib 0x12fc4 _dispatch_block_async_invoke2 + 148 10 libdispatch.dylib 0x3eac _dispatch_client_callout + 20 11 libdispatch.dylib 0x126a4 _dispatch_main_queue_drain + 928 12 libdispatch.dylib 0x122f4 _dispatch_main_queue_callback_4CF + 44 13 CoreFoundation 0x98c28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 14 CoreFoundation 0x7a560 __CFRunLoopRun + 1992 15 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 16 GraphicsServices 0x135c GSEventRunModal + 164 17 UIKitCore 0x39d6e8 -[UIApplication _run] + 888 18 UIKitCore 0x39d34c UIApplicationMain + 340 19 PSStore 0xbaa0 main + 2 (main.swift:2) 20 ??? 0x1b94fedec (Missing) Any body able to solve this random crash ?
7
0
1.8k
Sep ’23
After initializing the OS, the AirPrint API always prints on duplex when printing for the first time.
I want to use the AirPrint API, which is a standard OS printing function, programmatically on an iOS application to print directly to a printer by specifying single-sided printing instead of double-sided printing for the first print after the OS is initialised. 〇Verification environment ・Device: iPad 9 generation ・OS:OS16.6 ・Printer model: EPSON PX-S730 / Brother MFC-J7300CDW / Canon G5030 / EPSON PX-M791FT ※All printers used for verification support AirPrint and are capable of duplex printing. 〇Issue The duplex printing option can be specified from the program using the AirPrint API property "duplex", However, when printing is executed from the program, the specified print option "duplex printing" is not reflected in the AirPrint API. 〇Verification results Installed the developed print verification app on the device in factory default state, and executed the print process from the app to the printer. (1st time) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing was performed on both sides. (2nd and subsequent times) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing is done on one side. 〇Source Code The print verification application we developed uses the UIPrintInteractionController class in Swift to specify the printing options for duplex printing. We believe we can specify this by setting "info.duplex = UIPrintInfo.Duplex.none" in the following source code and adding it to printInfo. func buttonClick(_ sender: Any) { let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "PrintJob from PrintTestApp" // color printInfo.outputType = UIPrintInfo.OutputType.general // duplex mode for the print printInfo.duplex = UIPrintInfo.Duplex.none // set the single side option printController.printInfo = printInfo // PDF printing in project folder printController.printingItem = Bundle.main.url(forResource: "sample", withExtension: "pdf")! // printer settings let printer = UIPrinter(url: URL(string: "ipps://XXXXXXX/ipp/print")!) // direct printing printController.print(to: printer, completionHandler: { controller, completed, error in guard error == nil else { return } }) }
0
0
1.4k
Aug ’23
PrintKit crash +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:]
Watchdog killed the app because PrintKit is performing XPC operations on the main thread,see the call stacks below. __dispatch_sema4_timedwait __dispatch_semaphore_wait_slow +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:] __pk_mdns_resolveSynchronous -[PKPrinter(PKPrinterPrivate) resolveWithTimeout:] -[PKPrinter printerURL] -[UIPrinter _initWithPrinter:] -[UIPrinterSelectionOption setPrinter:] -[UIPrinterBrowserViewController tableView:didSelectRowAtIndexPath:] -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] -[UITableView _userSelectRowAtPendingSelectionIndexPath:] -[_UIAfterCACommitBlock run] -[_UIAfterCACommitQueue flush] __runAfterCACommitDeferredBlocks __cleanUpAfterCAFlushAndRunDeferredBlocks __UIApplicationFlushCATransaction __UIUpdateSequenceRun _schedulerStepScheduledMainSection _runloopSourceCallback ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ___CFRunLoopDoSource0 ___CFRunLoopDoSources0 ___CFRunLoopRun _CFRunLoopRunSpecific _GSEventRunModal -[UIApplication _run] _UIApplicationMain main main.m:26 start
0
0
1k
Jul ’23
How to print double-sided pages using UIPrintInteractionController(AirPrint) in Swift
I'm using UIPrintInteractionController(AirPrint) to print documents in my swift application. I was able to print the documents using my application, but all of them are printing in one-sided. Now i want to add a double-sided printing as an option to my application. After some research i found that it can be implement by adding info.duplex = UIPrintInfo.Duplex.longEdge to printInfo. I tried it using the below code. private var printController = UIPrintInteractionController.shared let info = UIPrintInfo.printInfo() info.duplex = UIPrintInfo.Duplex.longEdge <<<<<< info.jobName = "XXXPrint" info.orientation = .portrait printController.printInfo = info printController.print(to: printer, completionHandler: { [self] controller, completed, error in if(error != nil){ print("successfully") }else{ print("Printing error: \(error.localizedDescription)") } } But whether i set it in the code and run my application it is printing the pages by one-sided. So if some one can guide me to double-sided printing workable solution highly appreciated!!
0
0
1.3k
Jul ’23
PrintKitUI Crash - NSInternalInconsistencyException
My app is crashing intermittently when showing the printer options to print html data. I am unable to reproduce this crash however here is the stack trace from crash logs Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x9e88 __exceptionPreprocess 1 libobjc.A.dylib 0x178d8 objc_exception_throw 2 Foundation 0x545b4c _userInfoForFileAndLine 3 UIKitCore 0x14bc40 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] 4 UIKitCore 0x21a330 -[UITableView _createPreparedCellForRowAtIndexPath:willDisplay:] 5 UIKitCore 0x219f18 -[UITableView _heightForRowAtIndexPath:] 6 UIKitCore 0x219db4 -[UISectionRowData heightForRow:inSection:canGuess:] 7 UIKitCore 0x44cf98 -[UITableViewRowData heightForRow:inSection:canGuess:adjustForReorderedRow:] 8 UIKitCore 0x5a0ec -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:] 9 UIKitCore 0x44c520 -[UITableViewRowData rectForGlobalRow:heightCanBeGuessed:] 10 UIKitCore 0x44db74 -[UITableViewRowData globalRowsInRect:canGuess:] 11 UIKitCore 0x480050 -[_UITableViewUpdateSupport _faultInRealHeightsOfNeededElements] 12 UIKitCore 0x4ba2dc -[_UITableViewUpdateSupport _setupAnimations] 13 UIKitCore 0x2efb58 -[UITableView _updateWithItems:updateSupport:] 14 UIKitCore 0x2b3500 -[UITableView _endCellAnimationsWithContext:] 15 UIKitCore 0x271ea4 -[UITableView _updateSections:withUpdateAction:rowAnimation:headerFooterOnly:usingPresentationValues:] 16 UIKitCore 0xe70084 -[UITableView _reloadSectionHeaderFooters:withRowAnimation:] 17 PrintKitUI 0x60468 -[UIPrintOptionsTableViewController hideGatheringPrinterInfo] 18 libdispatch.dylib 0x24b4 _dispatch_call_block_and_release 19 libdispatch.dylib 0x3fdc _dispatch_client_callout 20 libdispatch.dylib 0x127f4 _dispatch_main_queue_drain 21 libdispatch.dylib 0x12444 _dispatch_main_queue_callback_4CF 22 CoreFoundation 0x9a6f8 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE 23 CoreFoundation 0x7c058 __CFRunLoopRun 24 CoreFoundation 0x80ed4 CFRunLoopRunSpecific 25 GraphicsServices 0x1368 GSEventRunModal 26 UIKitCore 0x3a23d0 -[UIApplication _run] 27 UIKitCore 0x3a2034 UIApplicationMain 28 PSStore 0xbaa0 main () 29 ??? 0x1e567c960 (Missing)
0
0
1.2k
May ’23
Crash when printing a document from UIActivityViewController or QLPreviewController on iOS 16
Seems like the printing doesn't appear to be worked correctly on iOS 16. We've been getting a lot of crash reports related to printing since iOS 16 was released, for instance print_crash_report.txt Unfortunately, we are unable to reproduce those crashes. This article says that SEGV_MAPERR crash is due to an invalid memory fetch. For this reason, we decided to debug our app with the Address Sanitizer tool enabled in Xcode. As a result, we found out that almost every time the app accesses a freed heap region when the print UI is presented. address_sanitizer_report.txt The were able to reproduce 2 cases in a separated project: Printing a docx file from QLPreviewController Printing the same file from UIActivityViewController passing WKWebView.viewPrintFormatter as an activity item. In order to get the error, once you get to the print UI start scrolling the document preview. See the sample code bellow: import UIKit import WebKit import QuickLook final class PrintCrashViewController: UIViewController { private let webView = WKWebView() /* 27 page document from the app bundle */ private lazy var docFileURL = URL(fileURLWithPath: Bundle.main.path(forResource: "description", ofType: "docx")!) override func loadView() { view = webView } override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItems = [ UIBarButtonItem(title: "QL", style: .plain, target: self, action: #selector(openQLPreview)), UIBarButtonItem(title: "Share", style: .plain, target: self, action: #selector(openActivityVC)) ] webView.loadFileURL(docFileURL, allowingReadAccessTo: docFileURL) } @objc private func openActivityVC() { let items: [Any] = [docFileURL, webView.viewPrintFormatter()] let activityVC = UIActivityViewController(activityItems: items, applicationActivities: nil) present(activityVC, animated: true) } @objc private func openQLPreview() { let qlPreviewVC = QLPreviewController() qlPreviewVC.dataSource = self present(qlPreviewVC, animated: true) } } extension PrintCrashViewController: QLPreviewControllerDataSource { func numberOfPreviewItems(in controller: QLPreviewController) -> Int { 1 } func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { docFileURL as NSURL } } Both approaches have been in our app for years.
1
2
1.9k
Apr ’23
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.9k
Apr ’23
Which errors can be handled by the UIPrintInteractionController.CompletionHandler
I would like to know what errors can be handled by the UIPrintInteractionController.CompletionHandler.According to the UIKit documentation, four constants were defined for UIPrintError.Code, but that is very rough and I don't know which error codes are returned at specific times. When I print from my iPad using AirPrint, can I get detailed errors such as out of ink, paper jam, or insufficient paper? Also, is there another way to get and handle print errors other than using the UIPrintInteractionController.CompletionHandler?
0
0
1.2k
Mar ’23
How to get the list of all the printer connected to ios device programmatically?
I want to print documents using UIPrintIntrectionController() and need to pass one of the available printer but i have to pass the printer programmatically instead of hardcoding the details of printer i tried using NetServiceBrower() but it is depreceted and resources are not available about it `let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "printing" printInfo.outputType = UIPrintInfo.OutputType.general printController.printInfo = printInfo let str = "hello" let dataStr: Data = Data(str.utf8) let data = NSData(data: dataStr) printController.printingItem = data //need to access a printer to pass to printerController let printer = ?? printController.print(to: printer)
0
1
1.1k
Mar ’23
Airprint - background printing produces blanks pages
When using iOS 16, when a pdf or image is printed from our app without interaction using UIPrintInteractionController.SharedPrintController and PrintToPrinterAsync(), the first item printed prints successfully but each successive print just prints out blank pages, even when printing the same pdf or image. This continues until the app is restarted. Once restarted, the first item will print correctly again but everything after will print blank pages. If a pdf or image is printed via the print UI with PresentAsync() or PresentFromRectInViewAsync(), the item will print properly each time. It seems there is some problem with PrintToPrinterAsync on iOS 16 and/or xcode 14 (tested with xcode 14.1).
2
2
2.6k
Feb ’23
AirPrint authentication using client certificate
Hello, Is the AirPrint authentication via client certificates supported in iOS 16.1? Bonjour specification defines an "air" key in the TXT record with a "certificate" as a valid option. We tried to import a certificate into iOS and modify our print server to negotiate the client certificate during the TLS handshake but iOS didn't provide any client certificate during the handshake. Thanks, Radim
0
3
961
Feb ’23
Page Setup dialog crashing on macOS Ventura 13.1
A small percentage of my customers is experiencing crashes when invoking the vanilla Page Setup dialog in our document-based macOS AppKit app. So far only AirPrint printers are affected though I cannot replicate the issue locally when printing to an AirPrint target. As soon as the Page Setup dialog is invoked via the usual runPageLayout: method in NSDocument the crash occurs deep inside the system frameworks in the PJCCreateSuggestedPaper() method: Crashed Thread:        0  Dispatch queue: com.apple.main-thread Exception Type:        EXC_BAD_ACCESS (SIGSEGV) Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Codes:       0x0000000000000001, 0x0000000000000000 Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process:   exc handler [16825] VM Region Info: 0 is not in any region.  Bytes before following region: 4402925568       REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL       UNUSED SPACE AT START --->         __TEXT                      1066f5000-1067ed000    [  992K] r-x/r-x SM=COW  ...M App Thread 0 Crashed::  Dispatch queue: com.apple.main-thread 0   PrintCore                        0x7ff81623d183 PJCCreateSuggestedPaper + 71 1   PrintingUI                           0x12ab25b43 0x12aadb000 + 305987 2   PrintingUI                           0x12ab259ef 0x12aadb000 + 305647 3   PrintingUI                           0x12aaf24c3 0x12aadb000 + 95427 4   PrintingUI                           0x12ab09ab6 0x12aadb000 + 191158 5   PrintingUI                           0x12ab093af 0x12aadb000 + 189359 6   PrintingUI                           0x12ab0fa85 0x12aadb000 + 215685 7   PrintingUI                           0x12ab15c52 0x12aadb000 + 240722 8   AppKit                            0x7ff80bc3b2af -[NSWindowController _windowDidLoad] + 548 9   AppKit                            0x7ff80bc36f78 -[NSWindowController window] + 110 10  AppKit                            0x7ff80c1767d4 -[NSPageLayout beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:] + 217 11  AppKit                            0x7ff80bfda3e7 __82-[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:]_block_invoke + 394 12  AppKit                            0x7ff80c06fce2 -[NSDocument(NSDocumentSerializationAPIs) _performActivity:] + 1672 13  AppKit                            0x7ff80c070e37 -[NSDocument(NSDocumentSerializationAPIs) performActivityWithSynchronousWaiting:usingBlock:cancellationHandler:] + 431 14  AppKit                            0x7ff80bfda257 -[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:] + 94 For the affected customers the crash is 100% reproducible. As there is no application specific code whatsoever in any of the stack traces and the app is using vanilla NSDocument methods to run the Page Setup dialog this very much looks like a bug in macOS Ventura... Any suggestions or workarounds highly appreciated! Cheers, Jay
1
1
1.6k
Jan ’23
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
7.5k
Nov ’22
crash on iOS 15 when use UIPrintInteractionController to print PDF file
Is is a bug of iOS 15 itself? What can I do to fix this? It crashs when [UIPrintPreviewViewController reloadVisibleItems] It only happends on iOS from 15.0.0 to 15.5.0 so far When will UIPrintPreviewViewController reloadVisibleItems ? We can't even reproduce the crash, but we get lots crash reports on Firebase. Source code UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; if (controller) { UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.duplex = UIPrintInfoDuplexLongEdge; controller.printInfo = printInfo; controller.printingItems = [self dataList]; LYWeakifySelf; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *controller, BOOL completed, NSError *error) { }; [controller presentAnimated:YES completionHandler:completionHandler]; } - (NSArray<NSData *> *)dataList { NSMutableArray *dataList = [NSMutableArray array]; [self enumerateDataUsingBlock:^(NSData *data, NSString *fileName) { [dataList addObject:data]; }]; return dataList; } Crash info on Firebase Fatal Exception: NSInternalInconsistencyException. attempt to delete item 1 from section 0 which only contains 0 items before the update. Stack trace 0 CoreFoundation __exceptionPreprocess 1 libobjc.A.dylib objc_exception_throw 2 Foundation _userInfoForFileAndLine 3 UIKitCore -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] 4 UIKitCore -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] 5 UIKitCore -[UICollectionView reloadItemsAtIndexPaths:] 6 UIKitCore -[UIPrintPreviewViewController reloadVisibleItems:] 7 UIKitCore __58-[UIPrintPreviewViewController updateLayoutWithPdfUpdate:]_block_invoke_2 8 Foundation __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ 9 Foundation -[NSBlockOperation main] 10 Foundation __NSOPERATION_IS_INVOKING_MAIN__ 11 Foundation -[NSOperation start] 12 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ 13 Foundation __NSOQSchedule_f 14 libdispatch.dylib _dispatch_block_async_invoke2 15 libdispatch.dylib _dispatch_client_callout 16 libdispatch.dylib _dispatch_main_queue_drain 17 libdispatch.dylib _dispatch_main_queue_callback_4CF 18 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ 19 CoreFoundation __CFRunLoopRun 20 CoreFoundation CFRunLoopRunSpecific 21 GraphicsServices GSEventRunModal 22 UIKitCore -[UIApplication _run] 23 UIKitCore UIApplicationMain 24 EverLens main.m - Line 14 main + 14
1
0
1.9k
Nov ’22
AirPrint booklet feature
AirPrint panel doesn’t show the booklet print feature. Is there a possibility to find / Has anybody found a work-around? None of the apps available at the app store seem to provide the feature. iPhone 8/iOS 15.6.1 and HP LaserJet Pro M501dn here.
0
0
1k
Aug ’22
Create printers for ios
In android there is a way to create a printer object inside of an app and that printer can be used on all the other apps, is available in the list of printer of the os. **Is there a way to do that in iphone? ** So I can create this printer object and can be seen in the native printing functionality and be used in all the apps installed on the device
0
0
1.2k
Apr ’22
PrintKitUI random crash
Code to print self.airPrintWebView.loadHTMLString(html, baseURL: nil) self.view.add(subView:self.airPrintWebView) let formatter = self.airPrintWebView.viewPrintFormatter() //1.5" margins for the page formatter.perPageContentInsets = UIEdgeInsets(top: HALF_INCH_INSET, left: ONE_INCH_INSET, bottom: ONEHALF_INCH_INSET, right: ONE_INCH_INSET) let activityVC = UIActivityViewController(activityItems: [formatter], applicationActivities: nil) // Prevents iBook and PDF from being options activityVC.excludedActivityTypes = [.openInIBooks, .markupAsPDF] activityVC.completionWithItemsHandler = { (activity, success, items, error) in self.airPrintWebView.removeFromSuperview() if shouldRemoveSenderButton { sender.removeFromSuperview() } PredictSpringApplication.sharedInstance.psAlertBlockView?.isHidden = false } if PSUtil.isIpad() { activityVC.popoverPresentationController?.sourceView = self.airPrintWebView activityVC.popoverPresentationController?.sourceRect = sender.frame } self.present(activityVC, animated: true, completion: nil) Crash Crashed: com.apple.main-thread 0 CoreGraphics 0x107e6c CGPDFDocumentIsEncrypted + 12 1 PrintKitUI 0x586b0 -[UIPrintPreviewPageFetcher redrawQuicklookPDF:] + 104 2 PrintKitUI 0x28f4c -[UIPrintPreviewViewController updateQuicklookPDF] + 148 3 Foundation 0xa6f14 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 24 4 Foundation 0x7b020 -[NSBlockOperation main] + 104 5 Foundation 0x7afb0 NSOPERATION_IS_INVOKING_MAIN + 16 6 Foundation 0x3c4d8 -[NSOperation start] + 708 7 Foundation 0x3c20c NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 16 8 Foundation 0x4189c __NSOQSchedule_f + 172 9 libdispatch.dylib 0x12fc4 _dispatch_block_async_invoke2 + 148 10 libdispatch.dylib 0x3eac _dispatch_client_callout + 20 11 libdispatch.dylib 0x126a4 _dispatch_main_queue_drain + 928 12 libdispatch.dylib 0x122f4 _dispatch_main_queue_callback_4CF + 44 13 CoreFoundation 0x98c28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 14 CoreFoundation 0x7a560 __CFRunLoopRun + 1992 15 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 16 GraphicsServices 0x135c GSEventRunModal + 164 17 UIKitCore 0x39d6e8 -[UIApplication _run] + 888 18 UIKitCore 0x39d34c UIApplicationMain + 340 19 PSStore 0xbaa0 main + 2 (main.swift:2) 20 ??? 0x1b94fedec (Missing) Any body able to solve this random crash ?
Replies
7
Boosts
0
Views
1.8k
Activity
Sep ’23
After initializing the OS, the AirPrint API always prints on duplex when printing for the first time.
I want to use the AirPrint API, which is a standard OS printing function, programmatically on an iOS application to print directly to a printer by specifying single-sided printing instead of double-sided printing for the first print after the OS is initialised. 〇Verification environment ・Device: iPad 9 generation ・OS:OS16.6 ・Printer model: EPSON PX-S730 / Brother MFC-J7300CDW / Canon G5030 / EPSON PX-M791FT ※All printers used for verification support AirPrint and are capable of duplex printing. 〇Issue The duplex printing option can be specified from the program using the AirPrint API property "duplex", However, when printing is executed from the program, the specified print option "duplex printing" is not reflected in the AirPrint API. 〇Verification results Installed the developed print verification app on the device in factory default state, and executed the print process from the app to the printer. (1st time) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing was performed on both sides. (2nd and subsequent times) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing is done on one side. 〇Source Code The print verification application we developed uses the UIPrintInteractionController class in Swift to specify the printing options for duplex printing. We believe we can specify this by setting "info.duplex = UIPrintInfo.Duplex.none" in the following source code and adding it to printInfo. func buttonClick(_ sender: Any) { let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "PrintJob from PrintTestApp" // color printInfo.outputType = UIPrintInfo.OutputType.general // duplex mode for the print printInfo.duplex = UIPrintInfo.Duplex.none // set the single side option printController.printInfo = printInfo // PDF printing in project folder printController.printingItem = Bundle.main.url(forResource: "sample", withExtension: "pdf")! // printer settings let printer = UIPrinter(url: URL(string: "ipps://XXXXXXX/ipp/print")!) // direct printing printController.print(to: printer, completionHandler: { controller, completed, error in guard error == nil else { return } }) }
Replies
0
Boosts
0
Views
1.4k
Activity
Aug ’23
PrintKit crash +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:]
Watchdog killed the app because PrintKit is performing XPC operations on the main thread,see the call stacks below. __dispatch_sema4_timedwait __dispatch_semaphore_wait_slow +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:] __pk_mdns_resolveSynchronous -[PKPrinter(PKPrinterPrivate) resolveWithTimeout:] -[PKPrinter printerURL] -[UIPrinter _initWithPrinter:] -[UIPrinterSelectionOption setPrinter:] -[UIPrinterBrowserViewController tableView:didSelectRowAtIndexPath:] -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] -[UITableView _userSelectRowAtPendingSelectionIndexPath:] -[_UIAfterCACommitBlock run] -[_UIAfterCACommitQueue flush] __runAfterCACommitDeferredBlocks __cleanUpAfterCAFlushAndRunDeferredBlocks __UIApplicationFlushCATransaction __UIUpdateSequenceRun _schedulerStepScheduledMainSection _runloopSourceCallback ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ___CFRunLoopDoSource0 ___CFRunLoopDoSources0 ___CFRunLoopRun _CFRunLoopRunSpecific _GSEventRunModal -[UIApplication _run] _UIApplicationMain main main.m:26 start
Replies
0
Boosts
0
Views
1k
Activity
Jul ’23
How to print double-sided pages using UIPrintInteractionController(AirPrint) in Swift
I'm using UIPrintInteractionController(AirPrint) to print documents in my swift application. I was able to print the documents using my application, but all of them are printing in one-sided. Now i want to add a double-sided printing as an option to my application. After some research i found that it can be implement by adding info.duplex = UIPrintInfo.Duplex.longEdge to printInfo. I tried it using the below code. private var printController = UIPrintInteractionController.shared let info = UIPrintInfo.printInfo() info.duplex = UIPrintInfo.Duplex.longEdge <<<<<< info.jobName = "XXXPrint" info.orientation = .portrait printController.printInfo = info printController.print(to: printer, completionHandler: { [self] controller, completed, error in if(error != nil){ print("successfully") }else{ print("Printing error: \(error.localizedDescription)") } } But whether i set it in the code and run my application it is printing the pages by one-sided. So if some one can guide me to double-sided printing workable solution highly appreciated!!
Replies
0
Boosts
0
Views
1.3k
Activity
Jul ’23
PrintKitUI Crash - NSInternalInconsistencyException
My app is crashing intermittently when showing the printer options to print html data. I am unable to reproduce this crash however here is the stack trace from crash logs Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0x9e88 __exceptionPreprocess 1 libobjc.A.dylib 0x178d8 objc_exception_throw 2 Foundation 0x545b4c _userInfoForFileAndLine 3 UIKitCore 0x14bc40 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] 4 UIKitCore 0x21a330 -[UITableView _createPreparedCellForRowAtIndexPath:willDisplay:] 5 UIKitCore 0x219f18 -[UITableView _heightForRowAtIndexPath:] 6 UIKitCore 0x219db4 -[UISectionRowData heightForRow:inSection:canGuess:] 7 UIKitCore 0x44cf98 -[UITableViewRowData heightForRow:inSection:canGuess:adjustForReorderedRow:] 8 UIKitCore 0x5a0ec -[UITableViewRowData rectForRow:inSection:heightCanBeGuessed:] 9 UIKitCore 0x44c520 -[UITableViewRowData rectForGlobalRow:heightCanBeGuessed:] 10 UIKitCore 0x44db74 -[UITableViewRowData globalRowsInRect:canGuess:] 11 UIKitCore 0x480050 -[_UITableViewUpdateSupport _faultInRealHeightsOfNeededElements] 12 UIKitCore 0x4ba2dc -[_UITableViewUpdateSupport _setupAnimations] 13 UIKitCore 0x2efb58 -[UITableView _updateWithItems:updateSupport:] 14 UIKitCore 0x2b3500 -[UITableView _endCellAnimationsWithContext:] 15 UIKitCore 0x271ea4 -[UITableView _updateSections:withUpdateAction:rowAnimation:headerFooterOnly:usingPresentationValues:] 16 UIKitCore 0xe70084 -[UITableView _reloadSectionHeaderFooters:withRowAnimation:] 17 PrintKitUI 0x60468 -[UIPrintOptionsTableViewController hideGatheringPrinterInfo] 18 libdispatch.dylib 0x24b4 _dispatch_call_block_and_release 19 libdispatch.dylib 0x3fdc _dispatch_client_callout 20 libdispatch.dylib 0x127f4 _dispatch_main_queue_drain 21 libdispatch.dylib 0x12444 _dispatch_main_queue_callback_4CF 22 CoreFoundation 0x9a6f8 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE 23 CoreFoundation 0x7c058 __CFRunLoopRun 24 CoreFoundation 0x80ed4 CFRunLoopRunSpecific 25 GraphicsServices 0x1368 GSEventRunModal 26 UIKitCore 0x3a23d0 -[UIApplication _run] 27 UIKitCore 0x3a2034 UIApplicationMain 28 PSStore 0xbaa0 main () 29 ??? 0x1e567c960 (Missing)
Replies
0
Boosts
0
Views
1.2k
Activity
May ’23
Crash when printing a document from UIActivityViewController or QLPreviewController on iOS 16
Seems like the printing doesn't appear to be worked correctly on iOS 16. We've been getting a lot of crash reports related to printing since iOS 16 was released, for instance print_crash_report.txt Unfortunately, we are unable to reproduce those crashes. This article says that SEGV_MAPERR crash is due to an invalid memory fetch. For this reason, we decided to debug our app with the Address Sanitizer tool enabled in Xcode. As a result, we found out that almost every time the app accesses a freed heap region when the print UI is presented. address_sanitizer_report.txt The were able to reproduce 2 cases in a separated project: Printing a docx file from QLPreviewController Printing the same file from UIActivityViewController passing WKWebView.viewPrintFormatter as an activity item. In order to get the error, once you get to the print UI start scrolling the document preview. See the sample code bellow: import UIKit import WebKit import QuickLook final class PrintCrashViewController: UIViewController { private let webView = WKWebView() /* 27 page document from the app bundle */ private lazy var docFileURL = URL(fileURLWithPath: Bundle.main.path(forResource: "description", ofType: "docx")!) override func loadView() { view = webView } override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItems = [ UIBarButtonItem(title: "QL", style: .plain, target: self, action: #selector(openQLPreview)), UIBarButtonItem(title: "Share", style: .plain, target: self, action: #selector(openActivityVC)) ] webView.loadFileURL(docFileURL, allowingReadAccessTo: docFileURL) } @objc private func openActivityVC() { let items: [Any] = [docFileURL, webView.viewPrintFormatter()] let activityVC = UIActivityViewController(activityItems: items, applicationActivities: nil) present(activityVC, animated: true) } @objc private func openQLPreview() { let qlPreviewVC = QLPreviewController() qlPreviewVC.dataSource = self present(qlPreviewVC, animated: true) } } extension PrintCrashViewController: QLPreviewControllerDataSource { func numberOfPreviewItems(in controller: QLPreviewController) -> Int { 1 } func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { docFileURL as NSURL } } Both approaches have been in our app for years.
Replies
1
Boosts
2
Views
1.9k
Activity
Apr ’23
Printing question
Is it posible to add printers by code in iphone? Do they need to have air print on them?
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’23
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.
Replies
1
Boosts
1
Views
1.9k
Activity
Apr ’23
Which errors can be handled by the UIPrintInteractionController.CompletionHandler
I would like to know what errors can be handled by the UIPrintInteractionController.CompletionHandler.According to the UIKit documentation, four constants were defined for UIPrintError.Code, but that is very rough and I don't know which error codes are returned at specific times. When I print from my iPad using AirPrint, can I get detailed errors such as out of ink, paper jam, or insufficient paper? Also, is there another way to get and handle print errors other than using the UIPrintInteractionController.CompletionHandler?
Replies
0
Boosts
0
Views
1.2k
Activity
Mar ’23
How to get the list of all the printer connected to ios device programmatically?
I want to print documents using UIPrintIntrectionController() and need to pass one of the available printer but i have to pass the printer programmatically instead of hardcoding the details of printer i tried using NetServiceBrower() but it is depreceted and resources are not available about it `let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "printing" printInfo.outputType = UIPrintInfo.OutputType.general printController.printInfo = printInfo let str = "hello" let dataStr: Data = Data(str.utf8) let data = NSData(data: dataStr) printController.printingItem = data //need to access a printer to pass to printerController let printer = ?? printController.print(to: printer)
Replies
0
Boosts
1
Views
1.1k
Activity
Mar ’23
Airprint - background printing produces blanks pages
When using iOS 16, when a pdf or image is printed from our app without interaction using UIPrintInteractionController.SharedPrintController and PrintToPrinterAsync(), the first item printed prints successfully but each successive print just prints out blank pages, even when printing the same pdf or image. This continues until the app is restarted. Once restarted, the first item will print correctly again but everything after will print blank pages. If a pdf or image is printed via the print UI with PresentAsync() or PresentFromRectInViewAsync(), the item will print properly each time. It seems there is some problem with PrintToPrinterAsync on iOS 16 and/or xcode 14 (tested with xcode 14.1).
Replies
2
Boosts
2
Views
2.6k
Activity
Feb ’23
AirPrint authentication using client certificate
Hello, Is the AirPrint authentication via client certificates supported in iOS 16.1? Bonjour specification defines an "air" key in the TXT record with a "certificate" as a valid option. We tried to import a certificate into iOS and modify our print server to negotiate the client certificate during the TLS handshake but iOS didn't provide any client certificate during the handshake. Thanks, Radim
Replies
0
Boosts
3
Views
961
Activity
Feb ’23
Page Setup dialog crashing on macOS Ventura 13.1
A small percentage of my customers is experiencing crashes when invoking the vanilla Page Setup dialog in our document-based macOS AppKit app. So far only AirPrint printers are affected though I cannot replicate the issue locally when printing to an AirPrint target. As soon as the Page Setup dialog is invoked via the usual runPageLayout: method in NSDocument the crash occurs deep inside the system frameworks in the PJCCreateSuggestedPaper() method: Crashed Thread:        0  Dispatch queue: com.apple.main-thread Exception Type:        EXC_BAD_ACCESS (SIGSEGV) Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Codes:       0x0000000000000001, 0x0000000000000000 Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process:   exc handler [16825] VM Region Info: 0 is not in any region.  Bytes before following region: 4402925568       REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL       UNUSED SPACE AT START --->         __TEXT                      1066f5000-1067ed000    [  992K] r-x/r-x SM=COW  ...M App Thread 0 Crashed::  Dispatch queue: com.apple.main-thread 0   PrintCore                        0x7ff81623d183 PJCCreateSuggestedPaper + 71 1   PrintingUI                           0x12ab25b43 0x12aadb000 + 305987 2   PrintingUI                           0x12ab259ef 0x12aadb000 + 305647 3   PrintingUI                           0x12aaf24c3 0x12aadb000 + 95427 4   PrintingUI                           0x12ab09ab6 0x12aadb000 + 191158 5   PrintingUI                           0x12ab093af 0x12aadb000 + 189359 6   PrintingUI                           0x12ab0fa85 0x12aadb000 + 215685 7   PrintingUI                           0x12ab15c52 0x12aadb000 + 240722 8   AppKit                            0x7ff80bc3b2af -[NSWindowController _windowDidLoad] + 548 9   AppKit                            0x7ff80bc36f78 -[NSWindowController window] + 110 10  AppKit                            0x7ff80c1767d4 -[NSPageLayout beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:] + 217 11  AppKit                            0x7ff80bfda3e7 __82-[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:]_block_invoke + 394 12  AppKit                            0x7ff80c06fce2 -[NSDocument(NSDocumentSerializationAPIs) _performActivity:] + 1672 13  AppKit                            0x7ff80c070e37 -[NSDocument(NSDocumentSerializationAPIs) performActivityWithSynchronousWaiting:usingBlock:cancellationHandler:] + 431 14  AppKit                            0x7ff80bfda257 -[NSDocument runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:] + 94 For the affected customers the crash is 100% reproducible. As there is no application specific code whatsoever in any of the stack traces and the app is using vanilla NSDocument methods to run the Page Setup dialog this very much looks like a bug in macOS Ventura... Any suggestions or workarounds highly appreciated! Cheers, Jay
Replies
1
Boosts
1
Views
1.6k
Activity
Jan ’23
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?
Replies
15
Boosts
0
Views
7.5k
Activity
Nov ’22
crash on iOS 15 when use UIPrintInteractionController to print PDF file
Is is a bug of iOS 15 itself? What can I do to fix this? It crashs when [UIPrintPreviewViewController reloadVisibleItems] It only happends on iOS from 15.0.0 to 15.5.0 so far When will UIPrintPreviewViewController reloadVisibleItems ? We can't even reproduce the crash, but we get lots crash reports on Firebase. Source code UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController]; if (controller) { UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.duplex = UIPrintInfoDuplexLongEdge; controller.printInfo = printInfo; controller.printingItems = [self dataList]; LYWeakifySelf; void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *controller, BOOL completed, NSError *error) { }; [controller presentAnimated:YES completionHandler:completionHandler]; } - (NSArray<NSData *> *)dataList { NSMutableArray *dataList = [NSMutableArray array]; [self enumerateDataUsingBlock:^(NSData *data, NSString *fileName) { [dataList addObject:data]; }]; return dataList; } Crash info on Firebase Fatal Exception: NSInternalInconsistencyException. attempt to delete item 1 from section 0 which only contains 0 items before the update. Stack trace 0 CoreFoundation __exceptionPreprocess 1 libobjc.A.dylib objc_exception_throw 2 Foundation _userInfoForFileAndLine 3 UIKitCore -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] 4 UIKitCore -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] 5 UIKitCore -[UICollectionView reloadItemsAtIndexPaths:] 6 UIKitCore -[UIPrintPreviewViewController reloadVisibleItems:] 7 UIKitCore __58-[UIPrintPreviewViewController updateLayoutWithPdfUpdate:]_block_invoke_2 8 Foundation __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ 9 Foundation -[NSBlockOperation main] 10 Foundation __NSOPERATION_IS_INVOKING_MAIN__ 11 Foundation -[NSOperation start] 12 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ 13 Foundation __NSOQSchedule_f 14 libdispatch.dylib _dispatch_block_async_invoke2 15 libdispatch.dylib _dispatch_client_callout 16 libdispatch.dylib _dispatch_main_queue_drain 17 libdispatch.dylib _dispatch_main_queue_callback_4CF 18 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ 19 CoreFoundation __CFRunLoopRun 20 CoreFoundation CFRunLoopRunSpecific 21 GraphicsServices GSEventRunModal 22 UIKitCore -[UIApplication _run] 23 UIKitCore UIApplicationMain 24 EverLens main.m - Line 14 main + 14
Replies
1
Boosts
0
Views
1.9k
Activity
Nov ’22
Printer Tray
Hello, how can I check the number of trays in the connected printer? Can I set a programmatically required tray for printing different paper sizes?
Replies
3
Boosts
0
Views
2.5k
Activity
Oct ’22
AirPrint booklet feature
AirPrint panel doesn’t show the booklet print feature. Is there a possibility to find / Has anybody found a work-around? None of the apps available at the app store seem to provide the feature. iPhone 8/iOS 15.6.1 and HP LaserJet Pro M501dn here.
Replies
0
Boosts
0
Views
1k
Activity
Aug ’22
Help with print
Documents with mixed size pages won’t print correctly
Replies
1
Boosts
0
Views
1.2k
Activity
Jul ’22
Quick Look
Hi! I'm new to Apple developing. Could anyone please tell me how to configure a quick look for my document? Also, how to print my document? Thanks🙏
Replies
1
Boosts
0
Views
2.0k
Activity
May ’22
Create printers for ios
In android there is a way to create a printer object inside of an app and that printer can be used on all the other apps, is available in the list of printer of the os. **Is there a way to do that in iphone? ** So I can create this printer object and can be seen in the native printing functionality and be used in all the apps installed on the device
Replies
0
Boosts
0
Views
1.2k
Activity
Apr ’22