Objective c &引用;“不允许打印”;在OSX应用程序中
我正在尝试打印一个简单的NSString值。但它给了我一个对话说:Objective c &引用;“不允许打印”;在OSX应用程序中,objective-c,macos,cocoa,Objective C,Macos,Cocoa,我正在尝试打印一个简单的NSString值。但它给了我一个对话说: "Printing Now Allowed This application is not allowed to print. Please contact your application vendor for an update." 我使用的代码是: -(void)printText:(NSString*)text { NSTextView *printView = [[NSTextView alloc] in
"Printing Now Allowed
This application is not allowed to print.
Please contact your application vendor for an update."
我使用的代码是:
-(void)printText:(NSString*)text
{
NSTextView *printView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 468, 648)];
[printView setString:text];
[[NSPrintOperation printOperationWithView:printView] runOperation];
}
有什么想法吗?找到了答案
我需要在“项目设置”中“我的目标”下的“摘要”下的“权限”下选中“允许打印”。转到您的项目-->YourProject.rights
添加以下键值
com.apple.security.print-是
对于请转到功能和应用程序沙盒,然后在硬件下找到“打印”复选标记
此问题还有另一个症状:当用户尝试打印时(无论如何从10.9.4开始),控制台将毫无帮助地记录:
找不到名为“GenericPostscriptPrinter”的图像。
在目标/签名和功能/应用程序沙盒中找到,打印复选框