Re: didPrint selector not called
Re: didPrint selector not called
- Subject: Re: didPrint selector not called
- From: Jeremy Hughes <email@hidden>
- Date: Fri, 16 Dec 2016 22:10:43 +0000
> On 16 Dec 2016, at 21:54, Jeremy Hughes <email@hidden> wrote:
>
>> In that case, you don’t know for sure who calls it and when. It appears to documented that it’s called as part of the standard implementation of “printDocument”, but you don’t know if there are other circumstances where it’s called from somewhere else.
>>
>> AFAICT you are required to invoke the passed-in selector at the correct time. In your case, that’s in your own document:didPrint:contextInfo: method, and therefore (I think) is going to require an invocation because you can’t perform a selector with a non-object parameter. So, yes, you might have to write some Obj-C glue to do this properly.
>>
>> My guess is that “doing it wrong” is going to be harmless in the case of regular printing from a menu, but it might break if (for example) AppleScript was involved, or something like that. Anyway, it’s your decision what to do. At least you’re aware of the possible issue now.
>
> Thanks. I’ve given up on overriding printDocumentWithSettings and I’m now overriding printDocument instead, following John’s suggestion.
You might say that this means I won’t be able to set a callback if printDocumentWithSettings is called from somewhere else (AppleScript or whatever).
All I’m trying to do is to clean up some objects which are no longer needed when the print operation is completed.
It’s not critical that this happens - the objects aren’t large, and if they don’t get cleaned up, they will be deallocated when the next print operation happens.
Maybe there’s an easier way to do this?
Jeremy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden