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

Multiple page print crashes App #5

Open
samoka opened this issue May 23, 2018 · 7 comments
Open

Multiple page print crashes App #5

samoka opened this issue May 23, 2018 · 7 comments

Comments

@samoka
Copy link

samoka commented May 23, 2018

Thanks for a great plugin!

I'm looping over some array and calling printLabel multiple times to print stickers, only the last call seems to succeed and then my App crashes. Any idea why that is? or I'm I doing something wrong?

@arcadius
Copy link

@samoka , have you found any solution to this issue?

@samoka
Copy link
Author

samoka commented Jul 1, 2019

@arcadius Unfortunately not, and it seems to happen more on Android devices.

@TristanGodal
Copy link

Hello, @samoka and @arcadius, any solution for this point ? I'm facing the same problem.

Regards.

@robr2112
Copy link

My general advice on this point is that (inside plugin) it’s best to do “startCommunication” and “endCommunication” only ONCE and print ALL images in between. Repeatedly opening and closing the port back to back (for each label) is likely to cause problems.

The v4 SDK provides API to print an array of image URLs. However changing this plugin to use v4 APIs instead of v3 will be a significant effort.

It may be worthwhile to add an API to the plugin that takes an array of URLs and handle it yourself with v3 (or v4) APIs. (NOTE: passing array of URLs instead of base64 images is much better on memory and less likely to cause memory problems).

All that said, it seems to me this would be happening a lot with this plugin where more than 1 image at a time is printed, but reports of this issue seem to be rare. So maybe there’s another explanation? Sorry, i dont the answer other than what i said above.

@arcadius
Copy link

thanks @robr2112 for the input.
The plugin support ios SDK v4 already
https://github.com/MenelicSoftware/cordova-plugin-brother-label-printer/releases/tag/1.5.4

@robr2112
Copy link

Yes i know you’re linking the v4 SDK (for ios anyway). However internally your code is still using v3 APIs (which is fine since v4 is backward compatible to v3). Eventually (not any time soon), the v3 APIs will be deprecated and removed in future SDK releases. Now, some v3 APIs are still required because not all v3 features are supported with v4 APIs. So we recommend migrating to v4 APIs eventually, but at your own pace depending on what features you need.

@robr2112
Copy link

Another reason the crash might be happening could be due to a memory problem in the app that i mentioned in earlier response….if the array contains base64 images instead of URLs (files). Maybe try loading only 1 image at a time into memory and then “release” the memory before trying the next one. This might be a solution.

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

4 participants