0

PhoneGap Iphone アプリケーションで XZing を実行しようとしています。

いくつかの調査を行った後、XZing をアプリケーションにインストールするための最良の手順については、次のリンクを見つけました。

ビルド中に XCode 4 が .h ファイルを見つけられないのはなぜですか?

手順を完了し、エラーなしでアプリを実行しました。

今、スキャナーを実行しようとしています。BarcodeScanner テスト ファイルを使用しています。コードは次のとおりです。

<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body onLoad="onLoad()">
        <div class="app">
            <div id="running-bits">

<button id="scan-button">scan: ?</button>

<p>(<span id="test-count-current">?</span>
/
<span id="test-count-total">?</span>)

<p><img id="image" src="">

<p>expected text:
<br><tt><span id="test-text">?</span></tt>

</div>

<p><b id="test-done"></b>
<br><button id="start-over">start over</button>

<p>Results:
<ul id="results-list">
</ul>
        </div>
        <script type="text/javascript" src="cordova-2.3.0.js"></script>
        <script src="js/barcodescanner.js"></script>
        <script src="js/phonegap-app.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

以下のリンクの phonegap-app.js のコード:

https://github.com/phonegap/phonegap-plugins/blob/master/iPhone/BarcodeScanner/test/phonegap-app/phonegap-app.js

ただし、スキャナーのスキャンボタンをクリックすると失敗し、ログに次のエラーが表示されます。

BarcodeScanner の失敗: 例外スキャン: TypeError: '未定義' はオブジェクトではありません

4

1 に答える 1

1

次のことを試すことができます:
1) Cordova.plist とバーコードスキャナーの JavaScript ファイルで、文字列 'org.apache.cordova.barcodeScanner' を 'CDVBarcodeScanner' に変更します。
2) barcodescanner.js で:
a) Cordova を cordova に変更します
b) 先頭に hasResource と addResource を含む行をコメント化します。

これが役立つことを願っています。

于 2013-01-24T17:51:31.410 に答える