Mac OS 10.13: NSPrintOperation with runOperationModalForWindow

Hello,


I am using NSPrintOperation with runOperationModalForWindow as following :


NSPrintOperation *op;
  NSPrintInfo *myPrintInfo;

myPrintInfo = [[NSPrintInfo alloc] init];
//
//     Set attributes of myPrintInfo
//
op = [NSPrintOperation printOperationWithView: detailsTextView printInfo:myPrintInfo];
  [op runOperationModalForWindow:[self window] delegate:nil didRunSelector:NULL contextInfo: NULL];



With the above code, It is working fine for all OS , except 10.13. On 10.13 OS for remote type Printer, execution hangs at runOperationModalForWindow. Following is sample where it hang:

Here what cares needs to take?


--------------------------------------------------------


runOperationModalForWindow:delegate:didRunSelector:contextInfo:] (in AppKit) + 536 [0x7fff4a00441a]

+ 2760 __91-[NSConcretePrintOperation runOperationModalForWindow:delegate:didRunSelector:contextInfo:]_block_invoke.385 (in AppKit) + 149 [0x7fff4a462967]

+ 2760 -[NSPrintPanel beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:] (in AppKit) + 576 [0x7fff4a005a2f]

+ 2760 -[NSWindowController window] (in AppKit) + 110 [0x7fff49d8cd0f]

+ 2760 -[NSWindowController _windowDidLoad] (in AppKit) + 547 [0x7fff49de8e8c]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0x15e40 [0x117168e40]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0x15f88 [0x117168f88]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0xabcb [0x11715dbcb]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0xb0a6 [0x11715e0a6]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0xaa1d [0x11715da1d]

+ 2760 ??? (in PrintCocoaUI) load address 0x117153000 + 0x1d251 [0x117170251]

+ 2760 CUPSPrinter::GetPPD(ppd_file_s**) (in PrintCore) + 270 [0x7fff4b0a4562]

+ 2760 cupsGetPPD (in libcups.2.dylib) + 58 [0x7fff72ea56d4]

+ 2760 cupsGetPPD3 (in libcups.2.dylib) + 479 [0x7fff72ea58ca]

+ 2760 ??? (in libcups.2.dylib) load address 0x7fff72e6c000 + 0x3a28f [0x7fff72ea628f]

+ 2760 _httpResolveURI (in libcups.2.dylib) + 1002 [0x7fff72e87887]

+ 2760 poll (in libsystem_kernel.dylib) + 10 [0x7fff7483209a]

......

..... ....


Thanks ,

Simran

Replies

I'm just gusssing after reading this:

https://stackoverflow.com/questions/29236929/printing-contents-of-wkwebview-os-x


Did you try setting the delegate to [self window] ?

Thanks for reply. tried with delegate [self Window] , It not works.


When TextEdit performs same Print options on that machine , It will also hangs for some 2 to 3 mins with Stack given below. Also regular Print activity seems slower on same machine.



[0x10faa8fb4]

+ 1309 ??? (in PrintCocoaUI) load address 0x10fa93000 + 0x54af [0x10fa984af]

+ 1309 CUPSPrinter::IsAirPrintPrinter(unsigned char*) (in PrintCore) + 51 [0x7fff3935e4f7]

+ 1309 CUPSPrinter::GetPPD(ppd_file_s**) (in PrintCore) + 270 [0x7fff39358562]

+ 1309 cupsGetPPD (in libcups.2.dylib) + 58 [0x7fff611596d4]

+ 1309 cupsGetPPD3 (in libcups.2.dylib) + 479 [0x7fff611598ca]

+ 1309 ??? (in libcups.2.dylib) load address 0x7fff61120000 + 0x3a28f [0x7fff6115a28f]

+ 1309 _httpResolveURI (in libcups.2.dylib) + 628 [0x7fff6113b711]

+ 1309 DNSServiceCreateConnection (in libsystem_dnssd.dylib) + 55 [0x7fff62a7b032]

+ 1309 ConnectToServer (in libsystem_dnssd.dylib) + 913 [0x7fff62a7993a]

+ 1309 sleep$NOCANCEL (in libsystem_c.dylib) + 41 [0x7fff62a10830]

+ 1309 nanosleep$NOCANCEL (in libsystem_c.dylib) + 188 [0x7fff629e9e77]

+ 1308 __semwait_signal_nocancel (in libsystem_kernel.dylib) + 10 [0x7fff62ae4d9a]

+ 1 cerror_nocancel (in libsystem_kernel.dylib) + 20