0
votes

First of all, sorry for my English. I'm running my Nativescript Angular App who uses the nativescript OCR 1.0.0 plugin. The recognition works good for Android OS but not for iOS. When I run the project in Visual Studio Code for MacOS, I have seen some issues like:

/Users/macintosh/....../platforms/ios/Pods/TesseractOCRiOS/TesseractOCR/G8TesseractParameters.h:2353:5: warning: '@param' command used in a comment that is not attached to a function declaration [-Wdocumentation]

ld: warning: directory not found for option '-F/Users/macintosh/Library/Developer/Xcode/DerivedData/........-ewfwairpchlyrihgevrrenyiqein/Build/Intermediates.noindex/ArchiveIntermediates/visaselectronicas/BuildProductsPath/Debug-iphoneos/TesseractOCRiOS' ld: warning: directory not found for option '-F/Users/macintosh/Library/Developer/Xcode/DerivedData/...........-ewfwairpchlyrihgevrrenyiqein/Build/Intermediates.noindex/ArchiveIntermediates/......../BuildProductsPath/Debug-iphoneos/TesseractOCRiOS' error: the following command failed with exit code 0 but produced no further output Ld /Users/macintosh/Library/Developer/Xcode/DerivedData/...........-ewfwairpchlyrihgevrrenyiqein/Build/Intermediates.noindex/ArchiveIntermediates/............./IntermediateBuildFilesPath/.........../Debug-iphoneos/???.build/Objects-normal/armv7/....... normal armv7 note: Using new build systemnote: Planning buildnote: Constructing build description

Please call SetImage before attempting recognition

Recognize failed, check the log for possible details.

What can I do in order to use the OCR plugin for iOS and to recognize correctly an image?

1
Based on error log it sounds like you are not passing the right image source to retrieve text. Can you show us some code? - Manoj
Thanks for your reply. Yes, I was not passing the right image source (Although it works on Android OS). I will post the answer with the code, before and after. - Edu Maldonado

1 Answers

0
votes

Original not working code part

doRecognize(args): void {
    let img: ImageSource = new ImageSource();
    img.fromAsset(args.imagenEnAsset);

    args.ocr.retrieveText({
        image: img,
        whitelist: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<",     
        blacklist: "/Ñ,",
        onProgress: (percentage: number) => {
            console.log(`Decoding progress: ${percentage}%`);
        }
    })

Now working code part

doRecognize(args): void {
    let img: ImageSource = new ImageSource();
    img.fromAsset(args.imagenEnAsset)
        .then(
            (imageSource) => {
                if (imageSource) {
                    args.ocr.retrieveText({
                        image: imageSource,
                        whitelist: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<",     
                        blacklist: "/Ñ,", 
                        onProgress: (percentage: number) => {
                            console.log(`Decoding progress: ${percentage}%`);
                        }
                    })