使用UIPrintInteractionController打印PDF ios 5可以工作,但在ios 6中不起作用并使我的应用程序崩溃

moy*_*dos 6 iphone objective-c airprint ios6

我有UIPrintInteractionController的问题我发送pdf打印和使用带有ios 5的设备当我按下打印按钮将文件发送到打印机并工作.但是当我在带有ios 6的设备上测试时,我无法工作并使应用程序崩溃.

当ios 6上显示UIPrintInteractionController的视图时,这是日志:

Save\032in\032folder\032Aptana\032Rubles._ipp._tcp.local.:
   Get-Printer-Attributes failed:    Undefined error: 0
No document-format-supported attribute found or no supported formats
   found.
No media-col-database found in response from printer.
Defaulting to generic media size values.
No print-quality-supported attribute found.  Defaulting to normal
   quality.
No sides-supported attribute found.  Defaulting to single-sided.
Run Code Online (Sandbox Code Playgroud)

这是我的代码:(self.myPDF是一个NMutableSData类型)

UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];

if  (controller && [UIPrintInteractionController canPrintData: self.myPDF] ) {



UIPrintInfo *printInfo = [UIPrintInfo printInfo];
    printInfo.outputType = UIPrintInfoOutputGeneral;
    printInfo.jobName = [NSString stringWithFormat:@"Coupon"];
    printInfo.orientation = UIPrintInfoOrientationPortrait;
printInfo.duplex = UIPrintInfoDuplexLongEdge;

    controller.printInfo = printInfo;
controller.showsPageRange =NO;

    controller.printingItem = self.myPDF;

    void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
    ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
        if (!completed && error) {

            UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Error." 
                                                         message:[NSString stringWithFormat:NSLocalizedString(@"An error occured while printing: %@", @"Printing error"), error]
                                                        delegate:nil 
                                               cancelButtonTitle:@"OK" 
                                               otherButtonTitles:nil, nil];

            [av show];
            [av release];
        }
    };

    [controller presentAnimated:YES completionHandler:completionHandler];
}
Run Code Online (Sandbox Code Playgroud)

我没有AirPrint支持的打印机,但我使用了handyPrint.注意:在iOS 6上,它使用handyPrint进行safari打印.

谁知道什么是错的?=(

Coc*_*ics 1

使用 Xcode 附带的 AirPrint 打印机模拟器进行测试。问题很可能是handyPrint 不支持AirPrint 中的新功能。