phonegap / phonegap-plugin-barcodescanner

cross-platform BarcodeScanner for Cordova / PhoneGap
MIT License
1.27k stars 1.41k forks source link

iOS Camera Crashing #92

Closed olimortimer closed 8 years ago

olimortimer commented 9 years ago

Our users are finding that the camera sometimes crashes as soon as the barcode scanner is opened. A force close and open of the app allows it to work correctly again.

iOS 9 with PhoneGap Barcodescanner 4.0.2 and PhoneGap 5.3.6

dahei commented 8 years ago

+1

Yes, I can confirm this. Only completely "killing" the app helps in these cases.

iPhone 6 iOS 9.1 Cordova 5.3.3. Scanner: 4.1.0

I think this is serious bug, which could prevent us from using the plugin in production.

at other devs:

Please comment, if you experience this issue as well to raise awareness for this.

YannKAPIT commented 8 years ago

We switch to another plugin, works perfectly on iOS9 (not tested with Android or Windows). Also launches faster than the phonegap one.

https://github.com/tjwoon/csZBar

dahei commented 8 years ago

Thanks for the hint! Hopefully the official plugin gets fixed, too.

YannKAPIT commented 8 years ago

Launch is faster and also recognition! Tested on both ipod and iphone (9.1), everything ok Need to test with 9.2 now...

dahei commented 8 years ago

It also has to work on Android for me - but I will give it a try, if this one here doesn't get fixed.

WebeWizard commented 8 years ago

Seeing the same thing after an upgrade to our cordova project.

iPad mini, iOS 9 Cordova 6.0.0 Barcodescanner 4.1.0 (upgraded from 2.0.1)

Loading the scanner for the first time completely crashes the app. After starting the app again, the scanner works correctly.

MaicolBen commented 8 years ago

+1

iPhone 6 iOS 9.1 Cordova 5.3.3. Plugin version: 4.1.0

MaicolBen commented 8 years ago

@sarangan12 It is still happening with version 5, the Telerik plugin doesn't have that bug

nikhilkh commented 8 years ago

Can you provide logs from the crash?

MaicolBen commented 8 years ago

@nikhilkh Maybe my issue was #30 , this workaround fixed my issue https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/30#issuecomment-121513124

WebeWizard commented 8 years ago

An update from my experience.

My crashes seem to be caused by running out of memory on the device. I especially noticed the crashes on older devices. Some of these older devices only have 500MB of available ram which is easily consumed by cordova, maybe a single browser tab, and a native calendar app for example. Opening the camera + scanner plugin consumes another 100MB+.

When iOS detects you only have 50MB or so free ram, it starts killing apps to free memory for the current app. Since the current app is technically the camera now, and not the cordova app, iOS will gladly kill your app for the sake of the camera.

I hope someone else finds this useful. Learning to profile cpu/memory iOS helped a lot.

taogogo commented 8 years ago

+1 crashed on my iphone ce. hope to fix this bug

FlummoxNL commented 8 years ago

same problem with iPad running 9.3.5. Also crashing on iPhone 5 & 7.

EddyVerbruggen commented 8 years ago

Using plugin 6.0.3?

FlummoxNL commented 8 years ago

Intel XDK; Cordova CLI v6.2.0, phonegap-plugin-barcodescanner v4.1.0.

This is how I have it working now, with the Options commented out.

function startScan() {
    cordova.plugins.barcodeScanner.scan(
        function ( result ) {

            if ( !result.cancelled ) {
                createPopup( 
                language.scannedcontest, 
                function() { parseScanResult( result );}, 
                language.scansucces, 
                [language.buttonpos] );

            } else {
                createPopup( 
                language.scanerror, 
                function() { console.log( result );}, 
                language.scancancelled, 
                [language.buttonpos] );
            }         
        },

        function ( error ) {
            createPopup( 
                language.scanerror + error, 
                function() { console.log( error );}, 
                language.scanerror + error, 
                [language.buttonpos] );
            } /*,
        {
            "preferFrontCamera" : true, // iOS and Android 
            "showFlipCameraButton" : true, // iOS and Android 
            "prompt" : "Place a barcode inside the scan area", // supported on Android only 
            "formats" : "QR_CODE", // default: all but PDF_417 and RSS_EXPANDED 
            "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device 
      }*/);
}
lock[bot] commented 6 years ago

This thread has been automatically locked.