OSX应用程序中的"不允许打印"

Sun*_*kas 8 macos cocoa objective-c

我正在尝试打印一个简单的NSString值.但它给了我一个对话:

"Printing Now Allowed

This application is not allowed to print.

Please contact your application vendor for an update."
Run Code Online (Sandbox Code Playgroud)

我使用的代码是:

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

有任何想法吗?

Sun*_*kas 15

找到答案了!

我需要在项目设置中的目标下的"摘要"下的"权利"下选中"允许打印".


Osm*_*man 6

转到功能和应用程序沙箱,然后在硬件下找到“打印”的复选标记

印刷