Содержимое AirPrint UIWebView в iOS8
Я пытаюсь AirPrint содержимое моего UIWebView (iOS8.1), и я получаю исключение без каких-либо подробностей о том, в чем проблема. Если я переключаю "Global Breakpoint State" в OFF в Xcode 6.1, то он иногда печатает, хотя иногда страница пуста. Я также использую современную установку Printopia для печати на iMac.
Кто-нибудь еще испытывает проблемы с AirPrinting в iOS8? Есть ли проблемы с кодом ниже, которые могут быть причиной этой проблемы?
// Функциональность AirPrint -(void)printBid { if ([UIPrintInteractionController isPrintingAvailable]) { // проверить, что мы можем напечатать// Использование UIPrintInteractionController для печати содержимого веб-представления // Это создает исключение, когда для параметра "Глобальное состояние точки останова" установлено значение "Вкл.", Но, похоже, оно работает, когда значение "Выкл."
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; //pic.delegate = self; UIPrintInfo *printInfo = [UIPrintInfo printInfo]; printInfo.outputType = UIPrintInfoOutputGeneral; printInfo.jobName = @"QuickBids"; printInfo.duplex = UIPrintInfoDuplexLongEdge; pic.printInfo = printInfo; pic.showsPageRange = YES; UIViewPrintFormatter *formatter = [bidPreviewWebView viewPrintFormatter]; pic.printFormatter = formatter; UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) { if(!completed && error){ NSLog(@"Print failed - domain: %@ error code %u", error.domain, error.code); } }; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // The device is an iPad running iPhone 3.2 or later. // iOS 8 Issue on iPad - As a workaround, I recommend delaying the presentation until the next runloop, using the following method: // http://stackru.com/questions/24854802/presenting-a-view-controller-modally-from-an-action-sheets-delegate-in-ios8 dispatch_async(dispatch_get_main_queue(), ^ { [pic presentFromBarButtonItem:shareButton animated:YES completionHandler:completionHandler]; }); }else { // The device is an iPhone or iPod touch. dispatch_async(dispatch_get_main_queue(), ^ { [pic presentAnimated:YES completionHandler:completionHandler]; }); } }else { // we can't print so show an alert // show simple alert UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Printing Unavailable" message:@"You cannot print from this device." preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; [alertController addAction:okAction]; [self presentViewController:alertController animated:YES completion:nil]; }
}
Заранее благодарю за любую помощь.