-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to PrintToPrinter in IOS15 #281
Comments
What resolved the crash for me was to edit UIPrintInteractionController+APPPrinter.m and wrap the ctrl.printInfo assignment with a dispatch_async as shown below.
|
Thank you Kloopler, I'll give that a try 👍 |
Hi @kloopler, would you be so kind as to share the code you have in the UIPrintInteractionController+APPPrinter.m file? |
Hi @AlisterRWood were you able to sort this error? we´re having the same issue and haven't found a fix yet. |
Sadly not... I tried wrapping nearly part of each function in a dispatch_async but never got it working. Let me know if you find anything that does work and I'll let you know if I do |
Thanks @AlisterRWood we´ll let you know for sure. |
Hi @legustav & @AlisterRWood, looks like this is a general problem in iOS15: https://developer.apple.com/forums/thread/689876 You need to update APPPrinter.m (l.259) like this to make it work again: dispatch_async(dispatch_get_main_queue(), ^{
// [ctrl printToPrinter:printer completionHandler:
// ^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
// [self rememberPrinter:(ok ? printer : NULL)];
// [self sendResultWithMessageAsBool:ok callbackId:callbackId];
// }];
[printer contactPrinter:^(BOOL available) {
if (available) {
[ctrl printToPrinter:printer completionHandler:
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
[self rememberPrinter:(ok ? printer : NULL)];
[self sendResultWithMessageAsBool:ok callbackId:callbackId];
}];
} else {
NSLog(@"printer unavailable");
}
}];
}); |
Thank you so much @Fauphi. That has got my app up and running again |
Many thanks @Fauphi @kloopler & @AlisterRWood for all the help! |
I am getting similar errors
If I start a print I get this warning above. If I cancel and hit my print button again my app crashes and I get the following
I'm going to keep trying some other things but this used to work just fine. The only thing that has changed I believe is iOS15 |
Apologies for the late reply. My app began crashing again after I updated to iPadOS v15.4.1. I found a work around that is a bit of a hack but it stopped the crashing. Here it is below. Basically runs ` - (void) printContent:(NSString *)content
|
@jameshhood did you manage to resolve this issue? |
* Fix : Unable to PrintToPrinter in IOS15 katzer#281 See katzer#281 (comment) * Fix : pick method returns null in IOS15 katzer#268 See katzer#268 * Fix : Unable to PrintToPrinter in AndroidX --------- Co-authored-by: IACHI Dimitri Fabien <[email protected]>
Hi Katzer, thanks so much for creating this plugin.. it's been fantastic.
Sadly since IOS 15 came out the printToPrinter function now throws an error
'Application tried to present modally a view controller <UIAlertController: 0x7fd9c205f000> that is already being presented by <UIViewController: 0x7fd9c0c139f0>.'
It can print using the picker controller but we need the silent printing options as it's customer facing.
Any help with this would be greatly appreciated
The text was updated successfully, but these errors were encountered: