正如标题所述,我在使用cordova.plugins.barcodeScanner.scan时遇到问题。
它可以与我测试过的所有其他设备(iPhone,Android智能手机和Android平板电脑)配合使用。使用iPad时会出现问题。
如下面的代码所示,我读取了QR码,然后将其发送到我的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保护壳需要使用任何特殊设置吗?
答案 0 :(得分:0)
非常奇怪...重新安装应用程序即可解决问题!