运行iOS的Nativescript OCR插件时出现的问题

时间:2019-01-28 19:53:18

标签: ios nativescript ocr angular2-nativescript nativescript-plugin

首先,对不起我的英语。我正在运行使用Nativescript OCR 1.0.0插件的Nativescript Angular App。识别对于Android OS很好,但不适用于iOS。当我在Visual Studio Code for MacOS中运行该项目时,我遇到了一些问题,例如:

  

/ Users / macintosh /....../ platforms / ios / Pods / TesseractOCRiOS / TesseractOCR / G8TesseractParameters.h:2353:5:警告:“ @ param”命令用于         未附加到函数声明[-Wdocumentation]

的注释      

ld:警告:找不到选项'-F / Users / macintosh / Library / Developer / Xcode / DerivedData /.....- ewfwairpchlyrihgevrrenyiqein / Build / Intermediates.noindex / ArchiveIntermediates / visaselectronicas / BuildProductsPath的目录/ Debug-iphoneos / TesseractOCRiOS'   ld:警告:找不到选项'-F / Users / macintosh / Library / Developer / Xcode / DerivedData /........- ewfwairpchlyrihgevrrenyiqein / Build / Intermediates.noindex / ArchiveIntermediates / ...的目录..... / BuildProductsPath / Debug-iphoneos / TesseractOCRiOS'   错误:以下命令失败,退出代码为0,但没有进一步输出   Ld /Users/macintosh/Library/Developer/Xcode/DerivedData/..............-ewfwairpchlyrihgevrrenyiqein/Build/Intermediates.noindex/ArchiveIntermediates/............./ IntermediateBuildFilesPath /.........../ Debug-iphoneos / ???。build / Objects-normal / armv7 / .......普通armv7   注意:使用新的构建系统注释:规划构建注释:构建构建说明

     

在尝试识别之前,请先致电SetImage

     

识别失败,请检查日志以获取可能的详细信息。

如何使用iOS的OCR插件并正确识别图像?

1 个答案:

答案 0 :(得分:0)

原始无效代码部分

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}%`);
        }
    })

现在的工作代码部分

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}%`);
                        }
                    })