Codenameone 条形码扫描库没有';在iOS上不起作用,但在Android上起作用
我尝试使用这个库在iOS上使用条形码扫描仪:它在Android上运行得很好,但当我的应用程序在iOS上打开相同的条形码扫描仪表单时,我的应用程序只是关闭,没有显示任何错误消息。 我必须扫描128个条形码。 也许我必须特别为IOS编辑属性 这是我的密码:Codenameone 条形码扫描库没有';在iOS上不起作用,但在Android上起作用,codenameone,Codenameone,我尝试使用这个库在iOS上使用条形码扫描仪:它在Android上运行得很好,但当我的应用程序在iOS上打开相同的条形码扫描仪表单时,我的应用程序只是关闭,没有显示任何错误消息。 我必须扫描128个条形码。 也许我必须特别为IOS编辑属性 这是我的密码: public class ScanCode extends Form { final Container cnt = this; public ScanCode(Form parent){ this.setLayout(new BoxLa
public class ScanCode extends Form {
final Container cnt = this;
public ScanCode(Form parent){
this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
Display.getInstance().setProperty("android.scanTypes", "CODE_128");
CodeScanner.getInstance().scanBarCode(new ScanResult() {
public void scanCompleted(String contents, String formatName, byte[] rawBytes) {
String word;
word= contents.substring(0,12);
List<Patient> myList= new ArrayList<>();
myList= RestManager.getList(contents.substring(0,12));
if(myList.size()==0){
new ManualInfo(parent,contents).show();
}
else{
Date date = new Date();
Intervention intervention = new Intervention();
intervention.setList(myList.get(0));
intervention.setDateAction(date);
intervention.setDateCreate(date);
intervention.setDateUpdate(date);
intervention.setEncodingType(Intervention.BARCODE_TYPE);
Update ajoutintervention = new Update();
ajoutintervention.setId((long) 0);
ajoutintervention.setDatas(intervention.toJson());
ajoutintervention.setDateCreate(date);
ajoutintervention.setDateUpdate(date);
ajoutintervention.setTreatment(String.valueOf(Constants.INSERT));
ajoutintervention.setDone(String.valueOf(false));
ajoutintervention.setClassName(intervention.getName());
ajoutintervention.setParam(myList.get(0).getWord());
DatabaseHelper.saveDataClass(ajoutintervention);
}
}
public void scanCanceled() {
cnt.addComponent(new Label("cancelled"));
}
public void scanError(int errorCode, String message) {
cnt.addComponent(new Label("err " + message));
}
});
}
公共类扫描码扩展表单{
最终容器cnt=此;
公共扫描码(表格上级){
这个.setLayout(新的BoxLayout(BoxLayout.Y_轴));
Display.getInstance().setProperty(“android.scanTypes”,“CODE_128”);
CodeScanner.getInstance().scanBarCode(新的ScanResult()){
public void scanCompleted(字符串内容、字符串格式名称、字节[]rawBytes){
字符串字;
字=内容。子字符串(0,12);
List myList=new ArrayList();
myList=RestManager.getList(contents.substring(0,12));
如果(myList.size()==0){
新手册信息(父项,目录).show();
}
否则{
日期=新日期();
干预=新干预();
setList(myList.get(0));
干预。设置日期操作(日期);
干预.setDateCreate(日期);
干预。setDateUpdate(日期);
干预.设置编码类型(干预.条形码类型);
Update ajointervention=new Update();
setId((长)0);
setDatas(intervention.toJson());
设置日期创建(日期);
aJointIntervention.setDateUpdate(日期);
setTreatment(String.valueOf(Constants.INSERT));
ajointervention.setDone(String.valueOf(false));
setClassName(intervention.getName());
setParam(myList.get(0.getWord());
DatabaseHelper.saveDataClass(Ajointervention);
}
}
已取消的公共文件(){
cnt.addComponent(新标签(“已取消”);
}
公共无效扫描错误(int错误代码、字符串消息){
cnt.addComponent(新标签(“错误”+消息));
}
});
}
编辑:
以下是构建提示:
codename1.arg.ios.add_libs=ExternalAccessory.framework;CoreBluetooth.framework;libc++.dylib;SystemConfiguration.framework;,libc++.dylib,CoreText.framework,MessageUI.framework,CoreVideo.framework,CoreMedia.framework
codename1.arg.ios.background_modes=,bluetooth-central,bluetooth-peripheral
codename1.arg.ios.debug.archs=arm64
codename1.arg.ios.includePush=true
codename1.arg.ios.newStorageLocation=true
codename1.arg.ios.plistInject=<key>NSBluetoothPeripheralUsageDescription</key><string>This app uses a BLE cardreader</string><key>UISupportedExternalAccessoryProtocols</key><array><string>bt.reader.library</string></array> <key>NSAppTransportSecurity</key> <dict><key>NSAllowsArbitraryLoads</key><true/></dict>
codename1.arg.ios.pods.platform=8.0,7.0
codename1.arg.ios.pods.sources=https\://github.com/CocoaPods/Specs.git
codename1.arg.ios.xcode_version=10.1
codename1.arg.java.version=8
codename1.arg.ios.add_libs=ExternalAccessory.framework;corebooth.framework;libc++.dylib;SystemConfiguration.framework;,libc++.dylib,CoreText.framework,MessageUI.framework,CoreVideo.framework,CoreMedia.framework
codename1.arg.ios.background_modes=,蓝牙中心,蓝牙外围设备
codename1.arg.ios.debug.archs=arm64
codename1.arg.ios.includePush=true
codename1.arg.ios.newStorageLocation=true
codename1.arg.ios.plistink=NSBluetooth外围设备使用说明此应用程序使用易读卡器iSupportedTernalAccessoryProtocolsBT.reader.library NSAppTransportSecurity NSAllowsArbiralLoads
codename1.arg.ios.pods.platform=8.0,7.0
codename1.arg.ios.pods.sources=https\://github.com/CocoaPods/Specs.git
codename1.arg.ios.xcode\u版本=10.1
codename1.arg.java.version=8
我使用的是12.1 iOS版本,设备是iPad Air。确保您的cn1lib是最新的,并且在模拟器上运行。您需要定义
iOS.nsCamerauseComiption
构建提示(或者codename1.arg.iOS.nsCamerauseComiption
,如果您直接编辑文件)。这是当前版本的iOS所必需的。当您在模拟器中运行代码时,库会隐式添加此项。确保您的cn1lib是最新的,并且您也在模拟器上运行了它。您需要定义iOS.NSCameraUsageDescription
生成提示(或codename1.arg.ios.NSCameraUsageDescription
如果直接编辑文件)。这是当前版本的iOS所必需的。当您在模拟器中运行代码时,库会隐式添加此项。您在设备上有哪些生成提示,哪些操作系统和设备版本?我编辑了我的问题以回答您。您在设备上有哪些生成提示,哪些操作系统和设备版本?我编辑了我的问题以回答您。