UIPrintInteractionController.shared on Mac OS Sonoma running iPad App

After updating to Mac OS Sonoma, we have encountered compatibility issues with our iPad-designed application, specifically with the AirPrint functionality, when it is run on MacOS. The AirPrint feature stopped working properly through UIPrintInteractionController.shared.

We have noticed that when we compile the application using Catalyst, the AirPrint functionality is restored and works as expected. However, this solution is not viable for us due to the restrictions associated with the frameworks we are utilizing.

We are seeking alternative solutions, and any help or guidance would be highly appreciated to resolve this issue and ensure a seamless and uninterrupted user experience in our application.

STEPS TO REPRODUCE

  1. Create an app for ipad with just a button and this code
var str = "TEST"
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = .general
printInfo.jobName = "Report"
printInfo.orientation = .portrait

let printController = UIPrintInteractionController.shared
printController.printInfo = printInfo
printController.showsNumberOfCopies = false
printController.showsPageRange = false
printController.showsNumberOfCopies = false

let formatter = UIMarkupTextPrintFormatter(markupText: str)
formatter.contentInsets = UIEdgeInsets(top: 72, left: 72, bottom: 72, right: 72)
printController.printFormatter = formatter
printController.present(animated: true, completionHandler: nil)

2.Run it on a MacOS with Sonoma, there is no error on console or anything but it don't work.

-If you run it with Catalyst it just works when adding the Printing permission of App Sandbox in Signing & Capabilities.

  • Does this occur when attempting to print? or presenting the print option?

Add a Comment

Replies

This sounds similar to the issue being discussed here: https://stackoverflow.com/questions/77555891/printing-issue-running-a-designed-for-ipad-app-on-macos/77570505

I have been testing exclusively on macOS 14+ and, unfortunately, I don't have a machine running an earlier macOS version on which to test.

Did you file a feedback report with Apple?

I would encourage anyone encountering this problem to file their own feedback report and reference FB13420491.

  • I have opened the issue at stackoverflow. I 'll report it at feedback assistant tomorrow.

Add a Comment

Has anyone found a solution? Printing no longer works in all of our apps on Sonoma 14.3.1 as "Designed tfor iPad" app. The detour via a WKWebView or PDF is not a solution for us because we print images in the exact size.

  • When we run an iPad app on macOS 14.3.1 as a "Designed for iPad" app and try to present the UIPrintInteractionController with presentAnimated, nothing happens. The app freezes and crashes.

    This message is displayed in the console: "CGContextClipToRect: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable."

    Feedback report: FB13637834

Add a Comment

The new macOS version Sonoma 14.4 has just been released. Unfortunately the bug is still not fixed. It is still not possible to print with a "Designed for iPad" app. However, more errors are now displayed in the console:

CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them
Failed to connect (genericPrinterImage) outlet from (PMPrinterSelectionController) to (NSImageView): missing setter or instance variable
Failed to connect (localPrintersLabel) outlet from (PMPrinterSelectionController) to (NSTextField): missing setter or instance variable
Failed to connect (otherPrintersLabel) outlet from (PMPrinterSelectionController) to (NSTextField): missing setter or instance variable
Failed to connect (recentPrintersLabel) outlet from (PMPrinterSelectionController) to (NSTextField): missing setter or instance variable
CGContextClipToRect: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

  • Seems also not fixed in 14.5 beta, from a quick test. I also see the same errors shown above on 14.5 beta.

Add a Comment