From 506e5bb190ff58cd79749805245bccb1b8cbfdec Mon Sep 17 00:00:00 2001 From: IACHI Dimitri Fabien Date: Fri, 15 Jul 2022 11:43:50 +0200 Subject: [PATCH] Fix : Unable to PrintToPrinter in IOS15 #281 See https://github.com/katzer/cordova-plugin-printer/issues/281#issuecomment-1121870473 --- src/ios/APPPrinter.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ios/APPPrinter.m b/src/ios/APPPrinter.m index d79ff0c5..52122f60 100755 --- a/src/ios/APPPrinter.m +++ b/src/ios/APPPrinter.m @@ -173,9 +173,12 @@ - (void) printContent:(NSString *)content withSettings:(NSDictionary *)settings { __block id item; + __block UIPrintInteractionController* ctrl; - UIPrintInteractionController* ctrl = - [UIPrintInteractionController sharedPrintControllerWithSettings:settings]; + dispatch_sync(dispatch_get_main_queue(), ^{ + ctrl = + [UIPrintInteractionController sharedPrintControllerWithSettings:settings]; + }); ctrl.delegate = self;