Search code examples
ioscordovaipadqr-codebarcode-scanner

Phonegap cordova.plugins.barcodeScanner.scan doesn't work on ipad


As the title says, I have a problem using cordova.plugins.barcodeScanner.scan.

It works with all the others devices I tested (iPhone, Android smartphones and Android tablets). With the iPad, there is a problem.

As you can see in the code below, I read a QR code and then send it to my API server.

In the server log I can see the value sent from the iPad is empty.

This is the code:

cordova.plugins.barcodeScanner.scan(
            function (result) {
                if (result.text == "") {
                    Notify("Aborted", "warning");
                    MyApp.app.navigate({ view: "Home" }, { root: true });
                    return;
                }
                vQR(result.text);

vQR is what I send to the server. It is empty from iPad, but correctly set from other devices.

This is my config:

<widget id="com.devexpress.apptemplate" version="1.0" versionCode="1">
  <name>ApplicationTemplate</name>
  <description>Template</description>
  <author email="info@info.com" href="http://www.info.com/">info</author>
  <preference name="permissions" value="none" />
  <preference name="prerendered-icon" value="true" />
  <preference name="phonegap-version" value="cli-7.0.1" />
  <preference name="android-windowSoftInputMode" value="adjustPan" />
  <preference name="SplashScreenDelay" value="3000" />
  <preference name="AutoHideSplashScreen" value="false" />
  <preference name="SplashShowOnlyFirstTime" value="false" />
  <preference name="FadeSplashScreen" value="false" />
  <preference name="ShowSplashScreenSpinner" value="false" />
  <preference name="DisallowOverscroll" value="true" />
  <preference name="StatusBarOverlaysWebView" value="false" />
  <preference name="StatusBarStyle" value="default" />

  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true" />
  </feature>
  <preference name="StatusBarBackgroundColor" value="#000000" />
  <preference name="android-minSdkVersion" value="15" />
  <preference name="android-targetSdkVersion" value="26" />
  <platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
  </platform>
  <platform name="ios">
    <resource-file src="GoogleService-Info.plist" />
  </platform>
  <plugin name="cordova-plugin-geolocation" spec="2.4.1" />
  <plugin name="cordova-plugin-inappbrowser" />
  <plugin name="cordova-plugin-splashscreen" onload="true" />
  <plugin name="cordova-plugin-whitelist" />
  <plugin name="cordova-plugin-ios-longpress-fix" />
  <!--<plugin name="cordova-plugin-statusbar" onload="true" />-->
  <plugin name="phonegap-plugin-push" spec="2.0.0" />
  <plugin spec="https://github.com/Telerik-Verified-Plugins/BarcodeScanner.git" source="git">
    <param name="CAMERA_USAGE_DESCRIPTION" value="To scan barcodes." />
  </plugin>
  <plugin name="cordova-plugin-camera" spec="^2.4.1" source="npm">
    <variable name="CAMERA_USAGE_DESCRIPTION" value="This app requires access to take picture and send them, if needed." />
    <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="This app requires access to the photo library to send them, if needed." />
  </plugin>
  <plugin name="cordova-android-support-gradle-release">
    <variable name="ANDROID_SUPPORT_VERSION" value="26.0.0"/>
  </plugin>
  <access origin="*" />
  <!--<engines>
    <engine name="android" spec="^6.3.0" />
  </engines>-->
</widget>

Are there any special settings I have to use for the iPad case?


Solution

  • Very very weird... reinstall the app solved the problem!