The following simple call to NSPrintOperation started running very slow and spinning color wheel:
NSPrintInfo* printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintOperation* opeation = [NSPrintOperation printOperationWithView:[self view] printInfo:printInfo];
[opeation runOperation];
With following log in console:
12:00:37.659430+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
12:00:38.660534+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
12:00:39.662490+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
12:00:40.663736+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
12:00:40.666875+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
12:00:41.667635+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
12:00:42.668884+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
12:00:43.669116+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
12:00:43.694588+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
12:00:44.694744+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
12:00:45.696010+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
12:00:46.697261+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
12:00:46.720609+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
12:00:47.720890+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
12:00:48.721326+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
12:00:49.721529+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
12:00:49.726589+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
12:00:50.727795+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
12:00:51.728552+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
12:00:52.728778+0300 PrintTest[2196:128061] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
Looks like it started after upgrading to macOS 10.14. It happens only when the sandbox enabled. Printing entitlement is checked. Other sandboxed apps, like Preview and TextEdit seems to be unaffected by this and start printing dialog quickly. Any ideas what can be done to fix this?