Phonegap cordova.plugins.barcodeScanner.scan 不适用于 ipad
Phonegap cordova.plugins.barcodeScanner.scan doesn't work on ipad
正如标题所说,我在使用 cordova.plugins.barcodeScanner.scan 时遇到问题。
它适用于我测试过的所有其他设备(iPhone、Android 智能手机和 Android 平板电脑)。使用iPad,有问题。
正如您在下面的代码中看到的,我读取了一个二维码,然后将其发送到我的 API 服务器。
在服务器日志中我可以看到从 iPad 发送的值是空的。
这是代码:
cordova.plugins.barcodeScanner.scan(
function (result) {
if (result.text == "") {
Notify("Aborted", "warning");
MyApp.app.navigate({ view: "Home" }, { root: true });
return;
}
vQR(result.text);
vQR 是我发送到服务器的。它在 iPad 中为空,但在其他设备中正确设置。
这是我的配置:
<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>
对于 iPad 案例,我必须使用任何特殊设置吗?
非常非常奇怪...重新安装应用程序解决了问题!
正如标题所说,我在使用 cordova.plugins.barcodeScanner.scan 时遇到问题。
它适用于我测试过的所有其他设备(iPhone、Android 智能手机和 Android 平板电脑)。使用iPad,有问题。
正如您在下面的代码中看到的,我读取了一个二维码,然后将其发送到我的 API 服务器。
在服务器日志中我可以看到从 iPad 发送的值是空的。
这是代码:
cordova.plugins.barcodeScanner.scan(
function (result) {
if (result.text == "") {
Notify("Aborted", "warning");
MyApp.app.navigate({ view: "Home" }, { root: true });
return;
}
vQR(result.text);
vQR 是我发送到服务器的。它在 iPad 中为空,但在其他设备中正确设置。
这是我的配置:
<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>
对于 iPad 案例,我必须使用任何特殊设置吗?
非常非常奇怪...重新安装应用程序解决了问题!