Sunkas
Sunkas

Reputation: 9590

"Printing Not Allowed" in OSX app

I am trying to print a simple NSString value. But It gives me a dialog saying:

"Printing Now Allowed

This application is not allowed to print.

Please contact your application vendor for an update."

The code I use is:

-(void)printText:(NSString*)text
{
    NSTextView *printView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 468, 648)];
    [printView setString:text];
    [[NSPrintOperation printOperationWithView:printView] runOperation];
}

Any ideas?

Upvotes: 12

Views: 3020

Answers (3)

Osman
Osman

Reputation: 1576

Go to Capabilities and to app Sandbox and then find under Hardware the checkmark for "PRINTING"

PRINTING

Upvotes: 9

Maddy
Maddy

Reputation: 389

Go to Your Project ---> YourProject.entitlements Add the following Key-Value

com.apple.security.print - YES

For more info

Upvotes: 4

Sunkas
Sunkas

Reputation: 9590

Found the answer!

I needed to check "Allow printing" under Entitlements under Summary under my target in project settings.

Upvotes: 22

Related Questions