Application Tool Kit

ATK SCWSingleCharWidget Swift Error Code 7: cannot create handwriting recognizer

Hi,

I'm currently trying to get the SingleCharWidget working in Swift. I've got as far as registering the certificate and being able to draw on the surface but after setting up the SCWSingleCharWidgetDelegate delegate the didConfigureWithSuccess method is reporting an error:

Error Code 7: cannot create handwriting recognizer

 

class ViewController: UIViewController {
    @IBOutlet weak var singleCharWidget: SCWSingleCharWidget!
    @IBOutlet weak var textView: UITextView!
    @IBOutlet weak var candidateLayout: UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if !singleCharWidget.registerCertificate(Data(bytes: myCertificate.bytes, count: myCertificate.length)) {
            print("SCWSingleCharWidget Certificate Registration Failed!")
            return
        }
        
        let resourcesPath = Bundle.main.path(forResource: "resources", ofType: "bundle")
        let resourcesURL = URL(fileURLWithPath: resourcesPath!)
        let configurationURL = resourcesURL.appendingPathComponent("conf")
        
        print("Configuration URL: \(configurationURL.path)")
        
        singleCharWidget.addSearchDir(configurationURL.path)
        singleCharWidget.configure(withBundle: "en_GB", andConfig: "si_text")
        
        singleCharWidget.inkColor = UIColor.init(red: 0.2, green: 0.71, blue: 0.898, alpha: 1.0)
        singleCharWidget.inkWidth = 7.0
        singleCharWidget.wordCandidateListSize = 5

        singleCharWidget.delegate = self
    }
}

extension ViewController: SCWSingleCharWidgetDelegate {
    func singleCharWidget(_ sender: SCWSingleCharWidget!, didConfigureWithSuccess success: Bool) {
        if !success {
            print("\(singleCharWidget.errorCode): \(singleCharWidget.errorString!)")
        }
    }
}

I have visited the bundle path to ensure that the relevant files are where they're needed. I'm using the en_GB resources just downloaded today. Can anyone help decipher what the issue is here? Thanks

image

image



Dear Mark,


thank you for contacting us and the interest you show to our products.


First, in your code, can you please ensure you set the inkColor, inkWidth and wordCandidateListSize parameters before calling the "configure" function ; otherwise, the parameter will not be set. Your code should then be as:


        singleCharWidget.addSearchDir(configurationURL.path)
        singleCharWidget.inkColor = UIColor.init(red: 0.2, green: 0.71, blue: 0.898, alpha:1.0)
        singleCharWidget.inkWidth = 7.0
        singleCharWidget.wordCandidateListSize = 5

        singleCharWidget.configure(withBundle: "en_GB", andConfig: "si_text")

      

Please note this is not likely to solve the error message you have.


Regarding the latter:

-Which value is set for the "configurationURL.path"? Does it correspond to your use-case?

-Is the "si_text" configuration properly defined in your en_GB.conf file? If so, are the files of this added into your resources?

-Also, are the Frameworks properly added to your project?


Also, please note on our side, ATK is no longer maintained, it was deprecated more than 2 years ago. We then do not recommend you start any new application with it.


Best regards,


Olivier

Hi Olivier,

If the library is deprecated I'll stop investigating the above issues but thank you for taking the time to look it over. May I ask for some pointers as to how I would approach making something similar to the SCWSingleCharWidget with the InteractiveInk library? Is there already a solution for this?

Kind regards

Mark

Dear Mark,


thank you for the update.


Did you try my below recommendations? Is it working?


Regarding your other question, at present there is no real substitution to the Single Char Widget (we cannot commit if there will be one in the mid-term). You can create an iink editor with "limited view size" (size of character), and remove the "text" resource in the configuration, but user experience will be quite different.


Best regards,


Olivier

Hi Olivier,

Yes I have double checked all the above:

Configuration URL: /Users/markedmunds/Library/Developer/CoreSimulator/Devices/E9603CAC-4073-46A7-9F81-0DA428E7E3FF/data/Containers/Bundle/Application/6721BD15-6228-41FF-AA25-882D877E1C06/NotesATK.app/resources.bundle/conf

image

si_text:

image

resources folder (relevant files from si_text are also in sub folders):

image


frameworks:

image

I'm still getting the same result after moving the config code also. As I mentioned before, I think I'll stop with the ATK and try achieving something with the current IInk SDK as that makes better sense. I'll give your suggestion a try. Thanks

Kind regards

Mark

Dear Mark,


in your Frameworks list, I do not see the ATKSharedUI.bundle. Did you add it in your project?


Best regards,


Olivier

Hi Olivier,

I had temporarily removed it but have put it back in now but still have the same issue I'm afraid. I've also tried putting all frameworks and bundles in as well.

Kind regards

Mark

Login or Signup to post a comment