2
我在这个极其奇怪的问题上挣扎了好几天。下面是初始化和呈现打印对话框,它的iOS 9之前,工作完美的标准代码:iOS 9:UIPrintInteractionController演示文稿问题
- (void)setupPrinting:(UIPrintInteractionController *)aPrintController
{
NSString *text = [self formattedHTMLforPrinting];
UIMarkupTextPrintFormatter *formatter = [[[UIMarkupTextPrintFormatter alloc] initWithMarkupText:text] autorelease];
aPrintController.printFormatter = formatter;
}
- (IBAction)printContent:(id)aSender {
if ([UIPrintInteractionController isPrintingAvailable]) {
UIPrintInteractionController *printController = [UIPrintInteractionController sharedPrintController];
printController.delegate = self;
[self setupPrinting:printController];
//tried different ways to present print controller
// [printController presentAnimated:NO completionHandler:nil];
// [printController presentFromRect:self.view.bounds inView:self.view animated:YES
//these two lines are just to make sure printButton is not nil
self.printButton.layer.borderColor = [UIColor redColor].CGColor;
self.printButton.layer.borderWidth = 1.0;
[printController presentFromRect:self.printButton.bounds inView:self.printButton animated:YES
completionHandler:^(UIPrintInteractionController *aPrintController, BOOL aCompleted, NSError *anError)
{
NSLog(@"printing is done with error: %@", anError);
}];
}
}
在iOS 9打印对话框显示错误,不能被解雇攻外模式的看法没有任何效果 - 应用程序变得反应迟钝。
我面临与最新版本的iOS相同的问题。你能帮我解决吗?你是如何修复它的? – spaleja