Zxing for iphone 使用 HTML5/javascript
我是ios开发新手。
有人可以告诉我吗?是否可以使用 Zxing lib 在 iPhone 上扫描条码/二维码以获取 Web 应用程序(HTML5/javascript)?
我的意思是我的web应用程序需要使用Zxing,这可能吗?
i am new to ios development .
can anybody pls tell me . is it possible to use Zxing lib for scanning bar/qr-code on iPhone for a webapp(HTML5/javascript) ?
i mean my webapp needs to use Zxing , Is it possible ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
条形码扫描需要使用手机上的摄像头,该设备无法从网络应用程序中使用,因此无论您想使用哪个库,都无法从网络应用程序中扫描条形码。
另外,我不认为你可以使用 javascript/html5 中的 C、C++、Objective C 库,这些库必须位于你的代码无法访问的手机上,并且你的浏览器肯定无法运行它。
一种替代方案是 PhoneGap,我对它不太熟悉,但它是一个围绕 Web 应用程序的 iOS(和/或 Android)外壳,作为本机应用程序运行。您可能会在那里获得相机支持,并且可能会使用 Zxing 库。您必须对此进行研究,但是您也不再“真正”拥有网络应用程序了。
编辑:对于phoneGap和Zxing另请参阅:如何使用phonegap扫描条形码
Barcode scanning requires use of the camera on your phone, this device is not available from a webapp and therefore you cannot scan barcodes from the webapp, regardless of the library you would like to use.
Also, I dont think you can use C, C++, Objective C libraries from your javascript/html5 these libs would have to be on the phone where your code cannot get to it, and your browser most certainly cant run it.
One alternative would be PhoneGap, I am not too familiar with it, but it is an iOS (and or Android) shell around a webapp that runs as a native app. You could probably get camera support in there and maybe use the Zxing lib. You would have to look into that, but then you dont 'really' have a webapp anymore either.
EDIT: For phoneGap and Zxing see also: how to scan barcode using phonegap
如今,您可以使用 HTML5 Camera API 和这个小美来让它工作; https://github.com/LazarSoft
尽情享受。
These days you can get it working with the HTML5 Camera API and this little beauty; https://github.com/LazarSoft
enjoy.