首页 > 解决方案 > MyScript Interactive Ink SDK 转换为数学返回?

问题描述

我正在使用 MyScript Interactive ink SDK 来转换手写数学方程。我使用他们拥有的测试示例测试了 SDK,一切都很好。我将他们的许多代码逻辑导入到我的应用程序中,并且能够成功设置引擎和编辑器。我可以编写项目,甚至可以在编辑器中使用重做、清除和撤消项目。问题是每次我试图隐藏它时,它都会返回一个“?”。

要转换的函数如下所示,与 MyScript 提供的示例中的代码完全相同 -

@IBAction func ConvertButtonWasTouchedUpInside(_ sender: UIBarButtonItem) {
    do {
        editorViewController.editor.waitForIdle()
        let supportedTargetStates = editorViewController.editor.getSupportedTargetConversionState(nil)
        try editorViewController.editor.convert(nil, targetState: supportedTargetStates[0].value)
    } catch {
        print("Error while converting : " + error.localizedDescription)
    }
    do
    {
        try equationInLatex = editorViewController.editor.export_(nil, mimeType: .laTeX)

    }
    catch
    {
        print("Error while printing : " + error.localizedDescription)
    }
    print(equationInLatex)
}

在 AppDelegate.swift 文件中为引擎创建包的代码和在引擎中设置的代码也是相同的。

我附上了一张关于返回值的图片

像这儿

在此处输入图像描述

我无法弄清楚为什么我会遇到此错误以及引擎和/或编辑器设置的哪一部分我做错了。

谢谢你!

标签: swiftxcodehandwriting-recognition

解决方案


看起来您缺少识别资产。

在提供的 GetStartedSwift 示例中,有一个recognition-assets在“复制捆绑资源”构建阶段引用的文件夹,如快照所示。您还必须将这些文件复制到您的项目中。

确认资产

如果您愿意,您可以重命名识别资产文件夹,但如果这样做,您必须更改"configuration-manager.search-path"AppDelegate.swift 中的设置

如果您只想要数学识别,您可能只想复制与数学相关的文件:conf/math.conf、、resources/math/math-ak.resresources/math/math-grm-atk.res


推荐阅读