PhoneGap中文网

 找回密码
 立即注册
查看: 12479|回复: 0
打印 上一主题 下一主题

phonegap.plugins.barcodescanner在ios上遇到的奇怪的问题

[复制链接]

12

主题

18

帖子

106

积分

注册会员

Rank: 2

积分
106
跳转到指定楼层
楼主
发表于 2015-12-7 15:57:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在Android上正常,在iOS不正常。用一个button设定ng-click='scan()',然后在controller中定义scan,
  1. $scope.scan = function(){
  2. cordova.plugins.barcodeScanner.scan(
  3.       function (result) {
  4.           alert("We got a barcode\n" +
  5.                 "Result: " + result.text + "\n" +
  6.                 "Format: " + result.format + "\n" +
  7.                 "Cancelled: " + result.cancelled);
  8.       },
  9.       function (error) {
  10.           alert("Scanning failed: " + error);
  11.       }
  12.    );
  13. }
复制代码
点开之后扫码界面出现了但是一动不动定格在那里(就像卡死)

我只需要在
  1. $scope.scan = function(){
  2. <font color="#ff0000">alert("Xxxx);</font>
  3. cordova.plugins.barcodeScanner.scan(
  4. function (result) {
  5. alert("We got a barcode\n" +
  6. "Result: " + result.text + "\n" +
  7. "Format: " + result.format + "\n" +
  8. "Cancelled: " + result.cancelled);
  9. },
  10. function (error) {
  11. alert("Scanning failed: " + error);
  12. }
  13. );
  14. }
复制代码
多加一个alert,然后扫码界面就能正常的调出来而且会正常工作。

实在太纠结为什么会有这样的情况,请教。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

ionic4视频教程

Archiver|手机版|小黑屋| PhoneGap中文网 ( 京ICP备13027796号-1 )  

GMT+8, 2024-5-20 22:04 , Processed in 0.029398 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表