Hi All.
In my app I’ve a method used to print some text on a printer. 

My code is 

        let printController = 
UIPrintInteractionController.sharedPrintController()
        
        let printInfo = UIPrintInfo(dictionary:nil)
        printInfo.outputType = UIPrintInfoOutputType.General
        printInfo.jobName = "note"
        printController.printInfo = printInfo
        
        func textFormatter(text: String) -> String
        {
            return text.stringByReplacingOccurrencesOfString("\n", withString: 
"<BR>")
        }
        
        let formatter = UIMarkupTextPrintFormatter(markupText: 
textFormatter(self.testo.text))
        formatter.contentInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, 
right: 10)
        printController.printFormatter = formatter
        
        if UIDevice.currentDevice().userInterfaceIdiom == .Pad
        {
            printController.presentFromRect(self.printBtn.frame, 
inView:self.view, animated:true, completionHandler: nil)
        }
        else
        {
            printController.presentAnimated(true, completionHandler: nil)
        }

This code works properly in iOS 8.3 but my app crash in iOS 9.3 when in the 
code above I call

printController.presentFromRect(self.printBtn.frame, inView:self.view, 
animated:true, completionHandler: nil)

I’ve noticed that the app doesn’t crash if the self.testo.text is an empty 
string. This behaviour is the same on the simulator and on a real device. 

Where is my mistake? Any Idea?

Regards 

Luca.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to