Interactive Ink

Answered

Can't add long email string by addBlock function

Hey Guys.

I'm having an issue when trying to programatically add an email (as text) as a new block on my Text Document part

 

[self.editor addBlock:pos type:contentType mimeType:IINKMimeTypeText data:text error:&error];

 The text contains "anndriamatropiggrandismo@missterqa.com".

But after executing the line, error contains "Error Domain=Interactive Ink SDK Error Domain Code=0 "Error, -[IINKEditor addBlock:type:mimeType:data:error:]::417 INVALID_STATE" UserInfo={NSLocalizedFailureReason=Error, -[IINKEditor addBlock:type:mimeType:data:error:]::417 INVALID_STATE}"

The courios thing is if I enter a shorter email, like "andriamatropiggrandismo@misterqa.com", the function works and the text is added.


Any hints?


Thanks


Best Answer

Dear Just,


thank you for your question.


Currently, you can refer to the API documentation of the addBlock function :https://developer.myscript.com/refguides/interactive-ink/android/1.3/com/myscript/iink/Editor.html#addBlock-float-float-java.lang.String-com.myscript.iink.MimeType-java.lang.String-


Based on your explanation, i.e. excepton only occurs when the email address is long, it looks like to the reason is there is not enough space for a new block (java.lang.IllegalStateException - if empty space around position is too small for a new block.)


You then understand the solution is that you constrain the size of the email address (or anything else that can match your use-case) to no longer have this behavior.


Best regards,


Olivier


Answer

Dear Just,


thank you for your question.


Currently, you can refer to the API documentation of the addBlock function :https://developer.myscript.com/refguides/interactive-ink/android/1.3/com/myscript/iink/Editor.html#addBlock-float-float-java.lang.String-com.myscript.iink.MimeType-java.lang.String-


Based on your explanation, i.e. excepton only occurs when the email address is long, it looks like to the reason is there is not enough space for a new block (java.lang.IllegalStateException - if empty space around position is too small for a new block.)


You then understand the solution is that you constrain the size of the email address (or anything else that can match your use-case) to no longer have this behavior.


Best regards,


Olivier

Hey Oliver!

Thanks for the quick response.

The test was done with the part empty (the block, if added, would be the first one). Also, I've tried with longer texts and it works without any issue, the only time it gives me this error is with long email address (or a long text without a space, like Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz).

Dear Just,


I confirm my analysis (we reproduced internally).


Indeed, when importing a string, if it happens to be wider than the screen, we split it using the spaces. If the string doesn't have any space, we are not able to cut it and return with the illegal state exception.


The only workaround is to limit the number of followed characters without a space.


Best regards,


Olivier


1 person likes this