BLUEPrinter.connect Printer does not connect printer through IOs
Closed this issue · 2 comments
vilsonei commented
- I have searched the issues of this repository and believe that this is not a duplicate.
Ask your Question
I'm developing an app for iOS, I can list the bluetooth printers by the BLEPrinter.getDeviceList method but when I call the BLEPrinter.connectPrinter method I get the error "'connectPrinter: Can't connect to printer 815DC3CD-7B45-E3FC-9C82-BD0B348CDF40'"
Could anyone give me a tip on how to solve this problem on IOs?
vilsonei commented
Sorted out! The problem was in the sequence of calls, to solve it I did the following:
- Call BLEPrinter.getDeviceList()
- After success call BLEPrinter.connectPrinter
See the code:
BLEPrinter.getDeviceList().then(devices => {
BLEPrinter.connectPrinter(mySavedMacAddressPrinter).then(printer => {
// In IOs the timeout was necessary for the print to be successful.
setTimeout(() => {
BLEPrinter.printText(txt);
}, 1000);
},
(e) => {
console.log(e);
});
});
joypatel04 commented
I am working on an iOS app and for some reason, I can't retrieve BLEPrinter.getDeviceList()
Did you receive the list of devices at your end?