[bug] CodeScanner doesn't work in ios

17 views
Skip to first unread message

Fuad Nassar

unread,
Feb 14, 2020, 10:17:56 AM2/14/20
to CodenameOne Discussions
Device: ios 13.1
our app need a scan qr code in ios device,so we tried to use this code to scan qr-code but that does not work for both package (codescan&ext.codescan)

import com.codename1.codescan.CodeScanner;
import com.codename1.codescan.ScanResult;
 if (CodeScanner.getInstance() != null) {
                CodeScanner.getInstance().scanQRCode(new ScanResult() {
                    public void scanCompleted(String contents, String formatName, byte[] rawBytes) {
                        Dialog.show("Completed", contents, "OK", null);
                    }

                    public void scanCanceled() {
                        Dialog.show("Cancelled", "Scan Cancelled", "OK", null);
                    }
                    public void scanError(int errorCode, String message) {
                        Dialog.show("Error", message, "OK", null);
                    }
                });
            } else {
                Dialog.show("Wearing", "CodeScanner == null", "OK", null);
            }
the result when run on ios(13.1): app does not do anything and scan does not be started

we know the above code was deprecated, so we tried add cn1-codescan.cn1lib with same above code just change imports to
import com.codename1.ext.codescan.CodeScanner;
import com.codename1.ext.codescan.ScanResult;
the result when run on ios(13.1): app was closed like is a pretty crash
we also tried ZXing-cn1.cn1lib but also there's no any doing. 

how we can scan qr code in ios with easy way?

Shai Almog

unread,
Feb 15, 2020, 1:17:00 AM2/15/20
to CodenameOne Discussions
Only the cn1lib will work, that code doesn't exist anymore in Codename One core. There might be a regression with 13.1 please file an issue and we'll look into it.

Fuad Nassar

unread,
Feb 25, 2020, 2:25:12 PM2/25/20
to CodenameOne Discussions

Thank you shai, 
actually the problem has fixed by add these hint
ios.NSCameraUsageDescription=Some functionality of the application requires access to your camera
Reply all
Reply to author
Forward
0 new messages