My OS X app supports 10.9 - 10.11. I try to add some options to a printing operation by adding a print accessory view like this:
MyPrintView *printView = [[MyPrintView alloc] initWithData: [self myData]];
NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView: printView];
NSPrintPanel *printPanel = [printOperation printPanel];
[printPanel addAccessoryController:[[MyPrintAccessory alloc] init]];
if (printOperation)
{
[printOperation runOperationModalForWindow:_window delegate:_window didRunSelector:nil contextInfo:nil];
}
The accessory view is defined by a controller
@interface MyPrintAccessory : NSViewController <NSPrintPanelAccessorizing>
and a view defined in a xib file.
All works perfectly as expected in El Capitan, but in Yosemite and Mavericks while the print panel let's me choose my accessory in the pop-up button, if I choose it, nothing is displayed, the space where the accessory view should be displayed remains empty. No error messages are generated neither at compile nor at runtime.
Does anybody have a hint on how to solve this, or a hint, how to search for the cause of this behaviour?
My application does the same thing, and works in 10.10
There is a slight difference, but to preface: My application is an
NSDocument-based application. When printing, I grab theNSPrintInfofrom theNSDocument, and feed it to my print method (the code you have embedded in your question)Looks like this:
Then, instead of calling
-printOperationWithView:, I call-printOperationWithView:printInfo:, and I pass theprintInfothat came from the senderFrom Apple's docs, you should call
-printOperationWithViewwhen:To me it sounds like it should work anyways, but like I said that's seemingly the only difference in our code