iOS8 and Safari no longer working with Bluetooth s

2019-04-10 08:50发布

问题:

I have a Web app that uses a bluetooth Opticon Scanner (http://www.opticonusa.com/products/companion-scanners)

The user taps into a field and scans a barcode and then the App does stuff with it.

Works GREAT under iOS7 and Safari.

No longer works under iOS8 and Safari. On scanning it often (but not always) drops off the last couple characters. The number of characters it drops seems somewhat random. Sometimes it does work. Very odd.

I went to other sites - yahoo.com, google.com and scanned into their search boxes. Exhibited the same behavior. So it's not specific to my Web App.

Scanning into NotePad or Email always works. Not a problem there. Just in Safari.

But here's the weirdest thing. We called the scanner company and they said it was an issue that's specific to Safari. Nothing they can do. They said download Chrome.

Sure enough - it works perfect in Chrome on the iPad! Last thing I want to do is tell my user base to download Chrome. :(

Has anyone seen anything like this? Any information or ideas? I thought other web browsers on iOS just kinda wrapped the Safari engine anyway so I don't even know what the difference can be.

Any information on this would be appreciated.

Thank you!

回答1:

Had the issue with a Socket CHS 7Mi Scanner till version 8.2 of iOS.

With the update to 8.3, this seems to be solved.



回答2:

This is a symptom of an underlying bug in Safari (iOS 8 only). I first encountered this problem when using a bluetooth barcode scanner in HID mode. Using the Notes app, I can scan very fast, with no characters skipped/truncated. In Safari, in the most simple web form, with a single input text field or textarea, the character skipping/truncating is intermittent. This is not specific to barcode scanners. You can reproduce the same issue with any bluetooth keyboard, if you can type fast enough but accurately so you know that it's skipping/truncating. If someone thinks I'm overlooking something, please chime in!

My findings:

I just installed iOS 8.2 beta on my iPad Air and the issue is still there. This only occurs with bluetooth keyboards paired in HID mode. I tracked the keyboard events while scanning and here's what I found. The textinput event fires for the first few characters but not for the rest. So I tried to scan this text: LOT00002. But the "T" and "2" were omitted because the TEXTINPUT event didn't fire after the keypress event. See bold lines...

keydown keyCode=76 (L) which=76 (L) charCode=0

keypress keyCode=76 (L) which=76 (L) charCode=76 (L)

textInput data=L

keyup keyCode=0 which=0 charCode=0

keydown keyCode=79 (O) which=79 (O) charCode=0

keypress keyCode=79 (O) which=79 (O) charCode=79 (O)

keyup keyCode=0 which=0 charCode=0

textInput data=O

keydown keyCode=84 (T) which=84 (T) charCode=0

keypress keyCode=84 (T) which=84 (T) charCode=84 (T)

keyup keyCode=0 which=0 charCode=0

[MISSING textInput event]

keydown keyCode=48 (0) which=48 (0) charCode=0

keypress keyCode=48 (0) which=48 (0) charCode=48 (0)

textInput data=0

keyup keyCode=0 which=0 charCode=0

keydown keyCode=48 (0) which=48 (0) charCode=0

keypress keyCode=48 (0) which=48 (0) charCode=48 (0)

keyup keyCode=0 which=0 charCode=0

textInput data=0

keydown keyCode=48 (0) which=48 (0) charCode=0

keypress keyCode=48 (0) which=48 (0) charCode=48 (0)

textInput data=0

keyup keyCode=0 which=0 charCode=0

keydown keyCode=48 (0) which=48 (0) charCode=0

keypress keyCode=48 (0) which=48 (0) charCode=48 (0)

textInput data=0

keyup keyCode=0 which=0 charCode=0

keydown keyCode=50 (2) which=50 (2) charCode=0

keypress keyCode=50 (2) which=50 (2) charCode=50 (2)

keyup keyCode=0 which=0 charCode=0

[MISSING textInput event]

keydown keyCode=13 which=13 charCode=0

keypress keyCode=13 which=13 charCode=13

keyup keyCode=0 which=0 charCode=0