iOS 17 beta 8 crash UIPrintPanelNavigationController

Hi everyone

I started to see crash in iOS 17 beta 8 when try to show UIPrintInteractionController

for iOS 16 and less it works fine

        let vc = UIPrintInteractionController.shared
        vc.printingItem = pdfFileUrl
        vc.present(animated: true) { (controller, success, error) in }

UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UIPrintPanelNavigationController shouldAutorotate] is returning YES

App supported only portrait orientation

in AppDelegate

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        return .portrait
    }
Post not yet marked as solved Up vote post of hanna_ad Down vote post of hanna_ad
1.4k views
  • I'm seeing the same problem in the general release version of iOS 17

Add a Comment

Replies

func printInteractionControllerParentViewController should return controller to show

Hi, same problem here. Have you any solution? Can you please explain your reply? Thank you for any advice

I was overriding present to force iPhone to present with full screen:

class NavigationController: UINavigationController {

// force everything presented to be presented fullscreen on iPhone but NOT on iPad

override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {

    if UIDevice.current.userInterfaceIdiom == .phone {

        viewControllerToPresent.modalPresentationStyle = .fullScreen

    }

    super.present(viewControllerToPresent, animated: flag, completion: completion)

}

}

When I stopped doing that the problem went away.

  • Just to be clear, the code snippet above was the cause of my problem.

  • Did you know, what was the reason, why forcing .fullscreen, modalPresentationStyle caused the problem?

Add a Comment

It's happening to me too.

Same issue! I am encountering an issue when previewing PDF files using QLPreviewController on devices running iOS 17 or later. The specific problem arises when I attempt to use the print function available in the share sheet of the QLPreviewController. This action results in a same crash.

  • Did you ever figure out a solution for this?

Add a Comment

I am also having same problem.

In iOS 17 below it is working fine.

In iOS 17 if I remove modalPresentationStyle then I dont see any crash.

  • for which controller you remove modalPresentationStyle? can you please elaborate?I am using UIDocumentInteractionController to show pdf. And when I present UIDocumentInteractionController and tap on share > Print, app crashes.

Add a Comment

@Akshay271 UINavigationController. Try this: if (![viewControllerToPresent isKindOfClass:[UINavigationController class]]) { viewControllerToPresent.modalPresentationStyle = UIModalPresentationFullScreen; }

  • Hi @Narendar tried above steps but still this doesn't resolve my issue.

Add a Comment

Hi,

It's happening to me too, the application is working fine for iOS 16 and below but on iOS 17 it's giving this error. I tried all the mentioned fixes but still getting this same error.

Was anyone able to pin point the exact reason?