wildabeast / BarcodeScanner

Official repository now at [phonegap/phonegap-plugin-barcodescanner](http://github.com/phonegap/phonegap-plugin-barcodescanner).
968 stars 746 forks source link

success-function returns nothing #340

Open infoforum opened 7 years ago

infoforum commented 7 years ago

Hello. Sorry for my English ) I added the plugin BarcodeScanner in my Phonegap-application. 1) Added to config.xml: <plugin name="com.phonegap.plugins.barcodescanner" spec="2.0.0" source="pgb" /> and <preference name="android-build-tool" value="gradle" /> 2) In the javascript:

cordova.plugins.barcodeScanner.scan(
      function (result) {
          alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
      }, 
      function (error) {
          alert("Scanning failed: " + error);
      }
   );

3) The finished application I created through the site build.phonegap.com

Should I do anything else? The scanner is triggered and even scans, that's just not give any value. When I press the Cancel button on the scanner, the application falls (closed). System log on the iPhone 5 contains the following entries after the scan:

Oct 11 20:18:49 iPhone MyApp[4669] <Warning>: WARNING: -[<AVCaptureVideoPreviewLayer: 0x15de5610> isOrientationSupported] is deprecated.  Please use AVCaptureConnection's -isVideoOrientationSupported
Oct 11 20:18:49 iPhone MyApp[4669] <Warning>: WARNING: -[<AVCaptureVideoPreviewLayer: 0x15de5610> setOrientation:] is deprecated.  Please use AVCaptureConnection's -setVideoOrientation:
Oct 11 20:18:49 iPhone MyApp[4669] <Warning>: WARNING: -[<AVCaptureVideoPreviewLayer: 0x15de5610> setOrientation:] is deprecated.  Please use AVCaptureConnection's -setVideoOrientation:
Oct 11 20:18:58 iPhone kernel[0] <Notice>: AppleH4CamIn::ISP_FlushInactiveDARTMappings: 0x00000000
Oct 11 20:18:58 iPhone MyApp[4669] <Error>: -[CDVPluginResult toSuccessCallbackString:]: unrecognized selector sent to instance 0x15d28ad0

Please tell me what is wrong?

Do I have to include the file: <script type = "text/javascript" src = "barcodescanner.js"></ script> in my index.html?