> On Dec 16, 2016, at 11:24 AM, Jeremy Hughes <moon.rab...@virginmedia.com> > wrote: > Thanks for the link. > > I’ve looked at it, and I don’t think it applies in this case, because I’m not > actually overriding the document(_:didPrint:contextInfo:) method, just > providing it as a callback. There isn’t an override keyword before the > method, and there isn’t a superclass method that I can call through to. I > suppose it would apply if I had a subclass (of my document class) that needed > to override the callback. Does that seem right to you?
You're overriding printDocumentWithSettings to ignore the passed-in delegate and selector. Unless you're certain that the passed-in delegate and selector are never useful, you're probably breaking something. John. > > Jeremy > > -- > >> On 16 Dec 2016, at 18:26, Quincey Morris >> <quinceymor...@rivergatesoftware.com> wrote: >> >> On Dec 16, 2016, at 08:45 , Jeremy Hughes <moon.rab...@virginmedia.com> >> wrote: >>> >>> 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) >>> } >> >> Apart from the bug John described, where the selector is incorrectly for a >> class method… >> >> It’s not absolutely clear, but I think this method comes under the aegis of >> “Advice for Overriders of Methods that Follow the >> delegate:didSomethingSelector:contextInfo: Pattern” in the OS X release >> notes archive: >> >> >> developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/ >> >> (Do a text search within the page to find the heading.) >> >> This’ll make your head hurt, but the essence of it is that you’re not >> allowed to throw away the selector that’s passed in to the method, and >> that’s exactly what you’re doing. >> >> Instead, you need to arrange for your “didPrint” method to invoke the >> originally passed-in selector, and depending on the order in which things >> need to happen, you make have to construct an invocation. I think (but I’m >> not certain) that yours is the “easy” case where you don’t need to construct >> the invocation, but you’re going to have to figure that out. >> > > > _______________________________________________ > > 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/rjmccall%40apple.com > > This email sent to rjmcc...@apple.com _______________________________________________ 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