Inside the app I am working on we have a place where a user can write text using MyScript and this works great.
Now we want to add an ability to support keyboard input (like Nebo app) and this is working always except when the user deletes all the text. Each time user changes the text inside UITextView the app (re)schedules timer which waits for X seconds until last keyboard touch to avoid throttling MyScript INKEditor with a lot of import commands. Then when the timer fires the app tries to import the text into editor like explained here.
Function for import is really simple, it only imports text into the INKEditor but when we want to import empty string it throws following error:
A help would be more than appreciated because I don't know what else should we use for importing the text into the editor.
Best Answer
J
Josip Bernat
said
over 1 year ago
Hi Oliver,
Even though it would be great to have an option to erase / import text without editor (i.e. if we want to make insert text into multiple notes at the same time) this does the trick!
Indeed, when trying to import empty text, an illegalStateException is raised, with the "text insertion failed" message (see our API reference)
The idea is that as any exception, you shall choose the action you want to make. E.g. you can simply do nothing, popup the user is trying to import empty text... or anything you prefer.
Best regards,
Olivier
J
Josip Bernat
said
over 1 year ago
Hi Oliver,
Thank you for your response. Unfortunately, this doesn't help me because I need a way to clear content entirely. Can you tell me how to do that?
I would like to avoid deleting the INK file and recreating it if possible.
Even though it would be great to have an option to erase / import text without editor (i.e. if we want to make insert text into multiple notes at the same time) this does the trick!
Josip Bernat
Hi,
Inside the app I am working on we have a place where a user can write text using MyScript and this works great.
Now we want to add an ability to support keyboard input (like Nebo app) and this is working always except when the user deletes all the text. Each time user changes the text inside UITextView the app (re)schedules timer which waits for X seconds until last keyboard touch to avoid throttling MyScript INKEditor with a lot of import commands. Then when the timer fires the app tries to import the text into editor like explained here.
Function for import is really simple, it only imports text into the INKEditor but when we want to import empty string it throws following error:
Error Domain=Interactive Ink SDK Error Domain Code=1 "Error, -[IINKEditor import_:data:selection:error:]::706 text insertion failed: " UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor import_:data:selection:error:]::706 text insertion failed: }
This is the code we use for import:
do {
try editor.import(mimeType: .text, data: text, selection: editor.rootBlock)
} catch {
print(error)
}
A help would be more than appreciated because I don't know what else should we use for importing the text into the editor.
Hi Oliver,
Even though it would be great to have an option to erase / import text without editor (i.e. if we want to make insert text into multiple notes at the same time) this does the trick!
Thanks,
Josip
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstOlivier @MyScript
Dear Josip,
thank you for contacting us.
Indeed, when trying to import empty text, an illegalStateException is raised, with the "text insertion failed" message (see our API reference)
The idea is that as any exception, you shall choose the action you want to make. E.g. you can simply do nothing, popup the user is trying to import empty text... or anything you prefer.
Best regards,
Olivier
Josip Bernat
Hi Oliver,
Thank you for your response. Unfortunately, this doesn't help me because I need a way to clear content entirely. Can you tell me how to do that?
I would like to avoid deleting the INK file and recreating it if possible.
Thanks,
Josip
Olivier @MyScript
Dear Josip,
did you try to clear the editor.
If so, what is not satisfying with the latter?
Thank you,
Best regards,
Olivier
Josip Bernat
Hi Oliver,
Even though it would be great to have an option to erase / import text without editor (i.e. if we want to make insert text into multiple notes at the same time) this does the trick!
Thanks,
Josip