Skip to content
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

pick method returns null #268

Open
mjirian opened this issue Nov 2, 2020 · 7 comments
Open

pick method returns null #268

mjirian opened this issue Nov 2, 2020 · 7 comments

Comments

@mjirian
Copy link

mjirian commented Nov 2, 2020

The following method does not open the printer selection window in iOS:

cordova.plugins.printer.pick({ top: 40, left: 30 }, callback);

The method returns null.

cordova.plugins.printer.print() works as expected.

@1nstinct
Copy link

Same for me. IOS 14 iPad.
image

@Phoenix-Alpha
Copy link

Same here. iPad Pro(4th generation).
Hope this issue would solved soon.

@1nstinct
Copy link

Hey guys. I think I found the solution. The plugin includes platform detection inside the code. The platform detection uses navigator.userAgent.indexOf('ipad') || navigator.userAgent.indexOf('iphone') to detect if the code is running on iPad or iPhone.
I removed the line for isIOS check and it started working like a charm. This is a temporary solution but it's better than nothing.
Later you can unbranch from master, create your own repository and use it with this fix for later plugin install actions. Go to
/cordova-plugin-printer/www/printer.js
image

@Zwimber
Copy link

Zwimber commented Nov 14, 2021

Dude that's amazing, thanks for figuring this out 💪

@kieranbarlow
Copy link

This must still be an issue because I'm struggling to get the pick method to fire on iOS 15

@kieranbarlow
Copy link

Removed the same isIOS and that got things working, thanks @1nstinct

Is this project still being maintained?

dimer47 added a commit to dimer47/cordova-plugin-printer that referenced this issue Aug 1, 2022
dimer47 added a commit to dimer47/cordova-plugin-printer that referenced this issue Aug 1, 2022
@dimer47
Copy link

dimer47 commented Aug 1, 2022

Thanks @1nstinct for finding the origin of the bug ❤️.
Personally, I added a check in the isIOS variable on a fork of the project.

|| window.cordova.platformId === "ios"

image

I created a PR hoping that @katzer would merge the fix 🤞🏻.
#293

KK998 added a commit to KK998/cordova-plugin-printer-2023 that referenced this issue Mar 13, 2023
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants