iink SDK on Device

Math import in iOS

Hi,

I want to import the text in "Math" content part following this code,

 do{

         try editorViewController.editor.import_(.text, data:"2+2", block: nil)

 }

  catch{

          print(error)

 }


But i can't able to import text in "Math" part.

Its throw the following error,

 -[IINKEditor import_:data:block:error:]::618 import failed: editor is not associated with a part



Dear Kannan,


Thank you for contacting us.


You can refer to the following topic that has the same issue: https://developer-support.myscript.com/support/discussions/topics/16000029360


Basically, no part was set to your editor. Please set a Math part.


Best regards,


Olivier

Hi,

Hi i have a math part. I want to import JIIX format into that math part which i have export from that editor.

But when i to import that JIIX format into MATH part , its throw the same following error,

-[IINKEditor import_:data:block:error:]::618 import failed: editor is not associated with a part}

But i have also set the setpart to my IINKEditor - "try editorViewController.editor.part = package.getPartAt(0)"

Create Math part code is following there,

  do {

                    if let package = try createPackage(packageName: "New\("\(Int.random(in: 0..<1000))")", blankPageType: "Math") {

                    editorViewController.editor.theme = ".guide { color: #ff0000ff }"

                    try editorViewController.editor.part = package.getPartAt(0)

 }                       

 }

       catch {

       print("Error while creating package : " + error.localizedDescription)

 }


How to resolve this issue?

Hi Kannan,


Thank you for your update.


In the code snippet above, you don't create a part, but are trying to retrieve one.


Please, refer to the HomeViewController of the GetStarted example, and update it with "Math" option, as you want to create a Math part:


            // Add a blank page type Math
            if let part = try resultPackage?.createPart("Math") /* Options are : "Diagram", "Drawing", "Math", "Raw Content", "Text Document", "Text" */ {
                self.title = "Type: " + part.type
            }


Best regards,


Gwenaëlle