iink SDK on Device

Answered

[iOS] Ink with shared framework

Hello,

I am have project with shared framework. I integrate SDK without pods and integrate headers and static links in this shared framework and use in my main iOS application. I use EditorViewController from Example projects (MyScriptIInkUIReferenceImplementation) and I have two issues:

1. I don't see pen trace. 


image



2. I need support russian language. I download and configure assets, but I see that Ink don't recognize russian language


image


   

 

// Configure the iink runtime environment
        let configurationPath = Bundle(for: self.classForCoder).bundlePath.appending("/recognition-assets/conf")
        do {
            try engine.configuration.setStringArray([configurationPath], forKey:"configuration-manager.search-path") // Tells the engine where to load the recognition assets from.
            try engine.configuration.setString("lang", forKey: "ru_RU");
        } catch {
            print("Should not happen, please check your resources assets : " + error.localizedDescription)
            return nil
        }

 Can you help me?   


Best Answer

Dear Pavel,


currently, in your code, you inverted the language and Key.


You should indeed set the russian language as follows: [configurationsetString:@"ru_RU"forKey:@"lang"error:nil];


Indeed, as the Russian could not be set, the English US was set by default.


Best regards,


Olivier


Dear Pavel,


thank you for contacting us.


Currently, did you re-implement the UIReferenceImplementation, or you manually add it into your project?


Indeed, error 1 is likely to be caused either by the drawCaptureStrokes function that is not called in the ImageDrawer or in the RenderView, or the CaptureRendenView not properly instantiated or initialized. Can you check in this way?


Regarding issue 2, when not setting any language, can you cofirm the english is set by default? If no, then this would mean the configurationPath is not set tp the path of the assets ; if so, can you please check the resources of the ru_RU.conf file have all been deployed: 

-recognition-assets\resources\ru_RU\ru_RU-ak-cur.res

-recognition-assets\resources\ru_RU\ru_RU-lk-text.res

-recognition-assets\resources\mul\mul-lk-english_secondary_1.res


Best regards,


Olivier

        

1. 

I find problem with first issue. Method initEditor from EditorViewController call before loadView and self.displayViewController is nil.

Simple fix this issue to add [self view] before createRendererWithDpiX.

  

[self view]; // Fix
    
IINKRenderer *renderer = [self.engine createRendererWithDpiX:scaledDpi() dpiY:scaledDpi() target:self.displayViewController error:nil];

 2. 

a) I check all files

image


  

let configurationPath = Bundle(for: self.classForCoder).bundlePath.appending("/recognition-assets/conf/")
let us = configurationPath.appending("en_US.conf")
NSLog("us_US exist: %i", FileManager.default.fileExists(atPath: us))
let ru = configurationPath.appending("ru_RU.conf")
NSLog("ru_RU exist: %i", FileManager.default.fileExists(atPath: ru))

2019-09-16 09:50:19.090314+0300 mp2019[39338:309279] us_US exist: 1
2019-09-16 09:50:25.131536+0300 mp2019[39338:309279] ru_RU exist: 1

 All files exist in package, but russian language don't recognize.

image


b) I remove en_EN configuration and resource files and get error "CONFIGURATION_BUNDLE_NOT_FOUND: error: no such configuration bundle en_US"

Do you have ideas how to fix?

Deae Pavel,


currently, as the smartGuide display a converted result, this would make me think that the russion recognition is enabled, otherwise, you would not have any result displayed.


Can you please try to export your result as String, and confirm it is not empty?


Best regards,


Olivier

Export as String is not empty and it is english string.

Code:

do {
            let text = try editorViewController.editor.export_(nil, mimeType: IINKMimeType.text)
           
            let alert = UIAlertController(title: "MyScript", message: text, preferredStyle: UIAlertController.Style.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.destructive, handler: nil))
            self.present(alert, animated: true, completion: nil)
} catch {
            print("Error while export : " + error.localizedDescription)
}

  

image

Answer

Dear Pavel,


currently, in your code, you inverted the language and Key.


You should indeed set the russian language as follows: [configurationsetString:@"ru_RU"forKey:@"lang"error:nil];


Indeed, as the Russian could not be set, the English US was set by default.


Best regards,


Olivier