2013-06-20 1 views
6

У меня проблема с UIPrintInteractionController. Я отправляю pdf для печати и с устройствами с ios 5, когда я нажимаю кнопку печати, отправляет файл в принтер и работает. но когда я тестирую устройства с ios 6, я не работаю и не разбиваю приложение.Печать PDF с помощью UIPrintInteractionController ios 5 работает, но в ios 6 не работает и отключается мое приложение

когда вид UIPrintInteractionController представлены на КСН 6 это бревно:

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. 

Вот мой код: (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]; 
} 

я не имею принтер, поддерживаемый AirPrint, но я использовал handyPrint. Примечание: на iOS 6 он работает с сафари, используя handyPrint.

Кто-нибудь знает, что не так? = (

+0

Вы пробовали печатать только один PDF документ или же это происходит с любым PDF doc вы пытаетесь распечатать? – sangony

+0

Я пытаюсь с Pdf в комплекте с проектом также UIimages и в ios 5 работает и сбой ios 6. – moynardos

+0

Мне неизвестны какие-либо изменения в UIPrintInteractionController от iOS 5 до iOS 6. Возможно, проблема заключается не в UIPrintInteractionController, а скорее в handyPrint, запущенном на iOS6. Если возможно, попробуйте использовать AirPrint, чтобы хотя бы исключить эту возможность. – sangony

ответ

1

Test его имитатора принтера AirPrint, который поставляется с Xcode. Проблема может быть очень хорошо в handyPrint не поддерживает новые функции AirPrint.