On Dec 16, 2016, at 08:45:00, Jeremy Hughes wrote:
Hi,I’m overriding printDocumentWithSettings in order to get a notification for when printing has finished, but the didPrint selector is never called.This is the code:class func document(document: NSDocument, didPrint: Bool, contextInfo: UnsafeMutablePointer<Void>){ print("document was printed”) }override func printDocumentWithSettings(printSettings: [String : AnyObject], showPrintPanel: Bool, delegate: AnyObject?, didPrintSelector: Selector, contextInfo: UnsafeMutablePointer<Void>){ let didPrint = #selector(Document.document(_:didPrint:contextInfo:))super.printDocumentWithSettings(printSettings, showPrintPanel: showPrintPanel, delegate: delegate, didPrintSelector: didPrint, contextInfo: contextInfo)} Does anyone know why this doesn’t work? Jeremy
[I am unfamiliar with Swift, so pardon my speaking in terms of ObjC...] Do you really need to override printDocumentWithSettings ? Won't printOperationWithSettings:error: do the job?If so you don't have to worry about explicitly setting the delegate (to your NSDocument) and don't have to worry about trying to pass signatures in Swift, etc. For me in such case document:didPrint:contextInfo: gets called automatically and successfully.
Manoah F. Adams mhfad...@federaladamsfamily.com federaladamsfamily.com/manoah This message is signed with a certificate and-or PGP key. Disregard any unverified messages from this address. Email Certificates for personal use can be obtained from Comodo at<https://secure.comodo.com/products/frontpage?area=SecureEmailCertificate >
For PGP/GPG key usage and tools, see <www.gnupg.org> ===========
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com